Created
September 6, 2011 18:36
-
-
Save rsobers/1198548 to your computer and use it in GitHub Desktop.
Bash script to forcefully kill stray Mod_Mono processes on FogBugz server
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# if there is more than one mod-mono-server2, we need to get aggressive | |
if [ `ps -fu fogbugz | grep mod-mono-server2 | wc -l` -gt 1 ]; then | |
# try to stop things gracefully | |
/etc/init.d/fogbugzctl stop | |
sleep 1 | |
echo "Killing all stray processes owned by fogbugz" | |
until [ `ps -fu fogbugz | grep fogbugz | wc -l` = 0 ]; do | |
pkill -u fogbugz | |
sleep 1 | |
done | |
until [ `ps -fu fogbugz | grep mod-mono-server2 | wc -l` -gt 0 ]; do | |
/etc/init.d/fogbugzctl start | |
sleep 1 | |
done | |
echo "Stopping heartbeat" | |
until [ `ps -fu fogbugz | grep heartbeat | wc -l` -lt 1 ]; do | |
/etc/init.d/fogbugzctl stop-hb | |
sleep 1 | |
done | |
echo "Hitting heartbeat with curl using fBreakLock=1" | |
curl http://localhost:7066/hearbeat.asp\?fBreakLock\=1 > /dev/null | |
echo "Starting heartbeat" | |
/etc/init.d/fogbugzctl start-hb | |
logger -s "Forcefully destroyed Mono." | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
A couple of critical things:
curl
is installed.logger
installed.http://localhost:7066
Modify the script accordingly.