Skip to content

Instantly share code, notes, and snippets.

@rsa
Created October 25, 2011 08:12
Show Gist options
  • Select an option

  • Save rsa/1311808 to your computer and use it in GitHub Desktop.

Select an option

Save rsa/1311808 to your computer and use it in GitHub Desktop.
Restarter shell script
#!/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