Skip to content

Instantly share code, notes, and snippets.

@jbussdieker
Last active August 29, 2015 14:20
Show Gist options
  • Save jbussdieker/92bb0b7d91f7105c32f8 to your computer and use it in GitHub Desktop.
Save jbussdieker/92bb0b7d91f7105c32f8 to your computer and use it in GitHub Desktop.
puppet_children
#!/bin/bash
PID=`ps -edf | grep "/usr/bin/ruby1.8 /usr/bin/puppet" | grep -v grep | awk '{print $2}'`
PIDS=`ps -edf | grep $PID | grep -v "/usr/bin/ruby1.8 /usr/bin/puppet" | grep -v grep | awk '{print $2}'`
for PID in $PIDS; do
echo $PID
echo cmdline: "`cat /proc/$PID/cmdline`"
echo cwd: "`ls -la /proc/$PID/cwd`"
if [ "x$1" == "x1" ]; then
kill -9 $PID
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment