-
-
Save jrimmer/1225975 to your computer and use it in GitHub Desktop.
Manage SmartFoxServer2x on Ubuntu - Start, stop, monitor w/Monit
This file contains 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
# Place in /etc/monit/conf.d/ | |
# Notes: Thresholds such as totalmen and cpu are application-specific | |
check process sfs with pidfile /var/run/sfs.pid | |
start program = "/etc/init.d/sfs start" | |
stop program = "/etc/init.d/sfs stop" | |
if cpu > 20% for 2 cycles then alert | |
if cpu > 25% for 5 cycles then restart | |
if totalmem > 2048.0 MB for 5 cycles then restart | |
if 5 restarts within 5 cycles then timeout |
This file contains 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 | |
# Place in /etc/init.d/ | |
# Notes: Runas, path, and memory settings are application-specific | |
case $1 in | |
start) | |
start-stop-daemon --start --background --oknodo --user game --group game --pidfile /var/run/sfs.pid --make-pidfile --startas /home/game/sfs/jre/bin/java --chuid game --chdir /home/game/sfs/SFS2X -- -Xms1024M -Xmx1024M -cp ./:lib/*:lib/Jetty/*:extensions/__lib__/* -Dfile.encoding=UTF-8 com.smartfoxserver.v2.Main $1 $2 >> /home/game/sfs/SFS2X/logs/smartfox.log | |
;; | |
stop) | |
start-stop-daemon --stop --pidfile /var/run/sfs.pid | |
;; | |
*) | |
echo "usage: sfs {start|stop}" ;; | |
esac | |
exit 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment