Source

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

Full commit
#!/bin/sh
# msj_other_server.sh
# includes mall,email,chat server

MSJ_BIN=/apps/msj/bin
MSJ_LUA=/apps/msj/lua
LUA_LOADER=${MSJ_BIN}/loadlua

usage () {
	echo "Usage:$0 {start|stop|restart}"
}

start() {
	cd ${MSJ_LUA}

	cd mall
	nohup ${LUA_LOADER} -I. mallmain.lua >/dev/null 2>&1 &
	cd -

	cd email
	nohup ${LUA_LOADER} -I. emailmain.lua >/dev/null 2>&1 &
	cd -

	cd sn
	nohup ${LUA_LOADER} -I. chatmain.lua >/dev/null 2>&1 &
	cd -
}

stop () {
	killall loadlua
}

## main


if test $# -ne 1 ;then
	usage
	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