commandlinefu.com is the place to record those command-line gems that you return to again and again.
You can sign-in using OpenID credentials, or register a traditional username and password.
Subscribe to the feed for:
Nginx (and other webservers like Apache) can be awkward to trace. They run as root, then switch to another user once they're ready to serve web pages. They also have a "master" process and multiple worker processes.
The given command finds the process IDs of all Nginx processes, joins them together with a comma, then traces all of them at once with "sudo strace." System trace output can be overwhelming, so we only capture "networking" output.
TIP: to kill this complex strace, do "sudo killall strace".
Compare with a similar command: http://www.commandlinefu.com/commands/view/11918/easily-strace-all-your-apache-processes
This command counts the number of blocked NGINX processes every 2 seconds and shows the last 22 measurements
You should have at least the number of cpu's in a non-blocked state.
The command up to the first ; truncates the log file.
I wrote this script to speed up Nginx configs. This (long) one liner can be run via BASH. You will see that we set a variable in bash called 'foo' and the streamline editor (sed) finds 'bar' in 'foo.conf' next it writes that output to a temp file (foo.temp) and removes the first 5 lines (that aren't needed in this case) & lastly it moves (overwrites) foo.temp to foo.conf
Taking file with ip ranges, each on it's own line like:
command returns deaggregated ip ranges using ipcalc deaggregate feature like that:
Useful for configuring nginx geo module