Panel/_agent-linux/includes/gsp_agent.init
copilot-swe-agent[bot] 4b771d498f Phase 2: Rename critical files (ogp_api.php to gsp_api.php, logos, agent files)
Co-authored-by: iaretechnician <2749183+iaretechnician@users.noreply.github.com>
2025-09-08 15:49:50 +00:00

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;