Created
October 25, 2011 08:12
-
-
Save rsa/1311808 to your computer and use it in GitHub Desktop.
Restarter shell script
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/bash | |
| lockfile="/var/lock/mangos" | |
| if [ -f $lockfile ]; then | |
| rm -f $lockfile | |
| fi | |
| expect ~/bin/mangos_cmd.exp .announce "Server shutdown after operation system request." | |
| sleep 1 | |
| expect ~/bin/mangos_cmd.exp .server shutdown "60" | |
| for (( i=1; $i<12; i++)); do | |
| sleep 10 | |
| echo -n . | |
| ps1=`ps -U mangos|grep worldd|sed 's/^ //'|sed 's/ .*//'` | |
| [ -z "$ps1" ] && break | |
| done | |
| echo | |
| if [ -f ~/worldd.pid ]; then | |
| # Critical reboot | |
| kill -9 $(ps -U mangos |grep worldd|sed 's/^ //'|sed 's/ .*//') | |
| fi | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment