woocode / sa-auto / sh / msj / msj_server.sh

#!/bin/sh
#ulimit -c unlimited;
#sleep 3;
MSJ_BIN=/apps/msj/bin
USER=apps

start(){
	cd ${MSJ_BIN}
	nohup ./watchdog ./domainsvr > domainsvr.log 2>&1 &
	su ${USER} -c "nohup ./watchdog ./worldsvr-ev 1 >/dev/null 2>&1 &"
	su ${USER} -c "nohup ./watchdog ./worldsvr-ev 2 > /dev/null  2>&1 &"
	
	sleep 10;
	
	su ${USER} -c "nohup ./watchdog ./gatesvr  > /dev/null 2>&1 &"
	su ${USER} -c "nohup ./watchdog ./gm  > /dev/null 2>&1 &"
	cd -

}
stop(){
	killall -q -9 watchdog
	killall -q -9 worldsvr-ev
	pkill 	domainsvr
	pkill	gatesvr
	pkill 	gm

}

if test $# -ne 1 ;then
	echo "Usage:$0 {start|stop|restart}"
	exit 1	
fi

CUR_USER=`whoami`

if test "${CUR_USER}" != "root" ;then
	echo  "\033[31mNOTE: Need to be root! \033[0m"
	exit 1
fi

case "$1" in 
	start)
		echo -n "Starting server..."
		start
		echo 	"OK!"
		;;
	stop)
		echo -n "Stopping server..."
		stop
		echo 	"OK!"
		;;
	restart)
		stop
		start
		;;
	*)
		echo "Usage:$0 {start|stop|restart}"
		exit 1
		;;	
esac

exit 0
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.