Skip to content

Instantly share code, notes, and snippets.

@leejones
Created March 18, 2011 14:44
Show Gist options
  • Save leejones/876182 to your computer and use it in GitHub Desktop.
Save leejones/876182 to your computer and use it in GitHub Desktop.
Find passenger processes that have gone off the tracks
#!/bin/sh
current_datetime=$(date | date +'%F-%H%M')
ps aux | grep current | grep -v grep | awk '{print $2}' > /tmp/passengers.$current_datetime.txt
passenger-status | grep PID | awk '{print $2}' >> /tmp/passengers.$current_datetime.txt
likely_freeloaders=$(uniq -u /tmp/passengers.$current_datetime.txt)
echo "Passenger doesn't know if these guys should be on the train"
echo $likely_freeloaders | xargs ps -o pid,command --no-headers
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment