43 lines
682 B
Bash
43 lines
682 B
Bash
#!/bin/bash
|
|
|
|
# Generic Init script if we can't find what kind of Linux we're on
|
|
|
|
agent_dir=GSP_AGENT_DIR
|
|
agent_user=OGP_USER
|
|
|
|
# Start function.
|
|
start() {
|
|
echo "Starting Game Server Agent..."
|
|
cd $agent_dir
|
|
su -c "screen -d -m -t agent -c screenrc -S agent ./agent_run -pidfile agent_run.pid" $agent_user &> $agent_dir/agent.svc &
|
|
echo
|
|
}
|
|
|
|
# Stop function.
|
|
stop() {
|
|
echo "Stopping Game Server Agent..."
|
|
kill `cat $agent_dir/agent_run.pid`
|
|
}
|
|
|
|
restart() {
|
|
stop
|
|
start
|
|
}
|
|
|
|
case $1 in
|
|
start)
|
|
start
|
|
;;
|
|
stop)
|
|
stop
|
|
;;
|
|
restart)
|
|
restart
|
|
;;
|
|
*)
|
|
echo "Usage: ogp_agent {start|stop|restart}"
|
|
exit 1
|
|
;;
|
|
esac
|
|
|
|
exit 0;
|