Skip to content

Instantly share code, notes, and snippets.

@noprompt
Created February 15, 2012 23:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save noprompt/1840041 to your computer and use it in GitHub Desktop.
Save noprompt/1840041 to your computer and use it in GitHub Desktop.
Kill rails processes and a random number of passengers.
PROCESS_ID=`ps aux | grep rails | grep -v grep | cut -d ' ' -f3 | head -n 1`
if [[ -n "$PROCESS_ID" ]]
then
kill -9 $PROCESS_ID
echo "Derailing the train! $RANDOM passengers have died ..."
else
echo "No train in site."
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment