Posts

Showing posts from 2017

Docker information

docker inspect - f \ '{{range $index, $value := .Config.Env}}{{$value}} {{end}}' container_name

Get network transfer information from linux

Whilst attempting to find some information for a project necessary on calculating (guesstimating) a budget for bandwidth used by a machine in the cloud I had to know where we were with current usage. Unfortunately the cloud services this VM sits in don't have any method exposed to show my usage and as such I turned to AskJeeves to find out some linux tools to help me out. First off the rank is  vnStat  which seems to be part of most of my Ubuntu boxes after looking at a few of them. Actually, that's the only necessary tool I used to get my data. By invoking vnstat with no parameters I got a nice printout of: ~$ vnstat Database updated: Mon Sep  4 00:17:31 2017    ens3 since 05/22/2017           rx:  1.25 TiB      tx:  21.85 TiB      total:  23.10 TiB    monthly                      rx      |     tx      |    total    |   avg. rate      ------------------------+-------------+-------------+---------------        Aug '17    194.53 GiB |    6.19 TiB |    6.38

Command-line installation of OpenVPN

OpenVPN’s installer allows for command-line based (silent) installation, but this feature is not actually documented explicitly anywhere. Here’s all I could find – hope this list will help someone in the same situation I was in. The installer allows you to specify is the installation should be “silent” (i.e. no GUI, nothing to click on), to specify custom installation directory (esp. useful if included in another installer, e.g. NSIS, and installing in the same directory as the target app), and components to install. The parameters can be used even when you’re not using the silent installation, to customize behavior of the graphical installer. /S      - silent installation /D=path - specify a custom installation path Note – the /D parameter has to appear last on the command line, and the path may not be inclosed in quotes. The installer simply takes all of the command line left, and uses it as path (thus supporting spaces in the path). To select individual OpenVPN components

My Windows PC doesn't keep time on the domain

Reports of users complaining of time not being correct on Windows 10 may have the time service not running. Open CMD prompt as an Administrator net stop w32time w32tm /unregister w32tm /register net start w32time Confirm the Windows Time service running via services.msc afterwards.

Check for duplicates in text file

cat normalFile.txt | uniq -c

One-liner for count of lsof apache workers

ps h --ppid $(cat /var/run/apache2/apache2.pid) | awk '{printf("%s,",$1)}' | sed 's/,\s*$//' | xargs lsof -p | wc -l This gets the child process thread information by accessing the root pid for apache2, passes it off to awk to return csv output (sed just removes the last comma) and passes it to lsof as an csv list of pid's as an arg so wc can count lines... Not particularly safe but does the job I need to monitor file descriptors for zombie apache2 child processes.