Fix server offline issue by updating OGP references to match agent changes

Co-authored-by: iaretechnician <2749183+iaretechnician@users.noreply.github.com>
This commit is contained in:
copilot-swe-agent[bot] 2025-09-05 23:02:41 +00:00
parent acb647488e
commit 08f83918f1
8 changed files with 49 additions and 50 deletions

View file

@ -195,7 +195,7 @@ then
echo "Writing Config file - $cfgfile" echo "Writing Config file - $cfgfile"
echo "%Cfg::Config = ( echo "%Cfg::Config = (
logfile => '${agent_home}/ogp_agent.log', logfile => '${agent_home}/agent.log',
listen_port => '${port}', listen_port => '${port}',
listen_ip => '${ip}', listen_ip => '${ip}',
version => '${AGENT_VERSION}', version => '${AGENT_VERSION}',
@ -521,7 +521,7 @@ then
ftpd_user=$(grep -oP '^User\s+\K.+' ${proFTPdConfFile}) ftpd_user=$(grep -oP '^User\s+\K.+' ${proFTPdConfFile})
ftpd_group=$(grep -oP '^Group\s+\K.+' ${proFTPdConfFile}) ftpd_group=$(grep -oP '^Group\s+\K.+' ${proFTPdConfFile})
if [ -z "$agent_user" ]; then if [ -z "$agent_user" ]; then
agent_user=$(grep -oP 'agent_user=\K.+' /etc/init.d/ogp_agent) agent_user=$(grep -oP 'agent_user=\K.+' /etc/init.d/agent)
fi fi
if [ ! -z "$ftpd_user" ] && [ ! -z "$ftpd_group" ] && [ ! -z "$agent_user" ] if [ ! -z "$ftpd_user" ] && [ ! -z "$ftpd_group" ] && [ ! -z "$agent_user" ]
then then

View file

@ -7,16 +7,16 @@ agent_user=OGP_USER
# Start function. # Start function.
start() { start() {
echo "Starting OGP Agent..." echo "Starting Game Server Agent..."
cd $agent_dir cd $agent_dir
su -c "screen -d -m -t ogp_agent -c ogp_screenrc -S ogp_agent ./ogp_agent_run -pidfile ogp_agent_run.pid" $agent_user &> $agent_dir/ogp_agent.svc & su -c "screen -d -m -t agent -c screenrc -S agent ./agent_run -pidfile agent_run.pid" $agent_user &> $agent_dir/agent.svc &
echo echo
} }
# Stop function. # Stop function.
stop() { stop() {
echo "Stopping OGP Agent..." echo "Stopping Game Server Agent..."
kill `cat $agent_dir/ogp_agent_run.pid` kill `cat $agent_dir/agent_run.pid`
} }
restart() { restart() {

View file

@ -1,15 +1,15 @@
#!/bin/bash #!/bin/bash
# #
### BEGIN INIT INFO ### BEGIN INIT INFO
# Provides: ogp_agent # Provides: agent
# Required-Start: $all # Required-Start: $all
# Required-Stop: $all # Required-Stop: $all
# Should-Start: $all # Should-Start: $all
# Should-Stop: $all # Should-Stop: $all
# Default-Start: 2 3 4 5 # Default-Start: 2 3 4 5
# Default-Stop: 0 1 6 # Default-Stop: 0 1 6
# Short-Description: Start and stop the OGP Agent # Short-Description: Start and stop the Game Server Agent
# Description: Start and stop the OGP Agent # Description: Start and stop the Game Server Agent
### END INIT INFO ### END INIT INFO
# #
@ -26,9 +26,9 @@ then
fi fi
start() { start() {
if [ -e "$agent_dir/ogp_agent_run.pid" ] if [ -e "$agent_dir/agent_run.pid" ]
then then
pid=$(cat $agent_dir/ogp_agent_run.pid) pid=$(cat $agent_dir/agent_run.pid)
out=$(kill -0 $pid > /dev/null 2>&1) out=$(kill -0 $pid > /dev/null 2>&1)
if [ $? == 0 ] if [ $? == 0 ]
then then
@ -90,14 +90,14 @@ start() {
fi fi
cd $agent_dir cd $agent_dir
out=$(su -c "screen -d -m -t ogp_agent -c ogp_screenrc -S ogp_agent ./ogp_agent_run -pidfile ogp_agent_run.pid" $agent_user >/dev/null 2>&1) out=$(su -c "screen -d -m -t agent -c screenrc -S agent ./agent_run -pidfile agent_run.pid" $agent_user >/dev/null 2>&1)
return 0 return 0
} }
stop() { stop() {
if [ -e "$agent_dir/ogp_agent_run.pid" ] if [ -e "$agent_dir/agent_run.pid" ]
then then
pid=$(cat $agent_dir/ogp_agent_run.pid) pid=$(cat $agent_dir/agent_run.pid)
kill -0 $pid > /dev/null 2>&1 kill -0 $pid > /dev/null 2>&1
if [ $? == 0 ] if [ $? == 0 ]
then then
@ -126,7 +126,7 @@ case "${1:-''}" in
RETVAL=$? RETVAL=$?
;; ;;
*) *)
echo "Usage: service ogp_agent start|stop|restart" echo "Usage: service agent start|stop|restart"
exit 1 exit 1
;; ;;
esac esac

View file

@ -12,14 +12,14 @@ depend() {
} }
start() { start() {
ebegin "Starting OGP Agent" ebegin "Starting Game Server Agent"
start-stop-daemon --verbose --chdir $agent_dir --start --background --user $agent_user -e PWD="$agent_dir" --exec screen -d -m -t ogp_agent -c ogp_screenrc -S ogp_agent ./ogp_agent_run -pidfile ogp_agent_run.pid start-stop-daemon --verbose --chdir $agent_dir --start --background --user $agent_user -e PWD="$agent_dir" --exec screen -d -m -t agent -c screenrc -S agent ./agent_run -pidfile agent_run.pid
eend $? "Failed to start OGP Agent" eend $? "Failed to start Game Server Agent"
} }
stop() { stop() {
ebegin "Stopping OGP Agent" ebegin "Stopping Game Server Agent"
start-stop-daemon --stop --quiet --pidfile $agent_dir/ogp_agent_run.pid start-stop-daemon --stop --quiet --pidfile $agent_dir/agent_run.pid
eend $? "Failed to stop OGP Agent" eend $? "Failed to stop Game Server Agent"
} }

View file

@ -1,16 +1,16 @@
#!/bin/sh #!/bin/sh
# #
# Startup/shutdown script for the OGP Agent. # Startup/shutdown script for the Game Server Agent.
# #
# Linux chkconfig stuff: # Linux chkconfig stuff:
# #
# chkconfig: 2345 88 10 # chkconfig: 2345 88 10
# description: Startup/shutdown script for the OGP Agent # description: Startup/shutdown script for the Game Server Agent
agent_dir=OGP_AGENT_DIR agent_dir=OGP_AGENT_DIR
agent_user=OGP_USER agent_user=OGP_USER
service=ogp_agent service=agent
# Source function library. # Source function library.
if [ -f /etc/rc.d/init.d/functions ] ; then if [ -f /etc/rc.d/init.d/functions ] ; then
@ -23,7 +23,7 @@ if [ "$( whoami )" != "root" ]
then then
if [ -f "/usr/bin/sudo" ] && [ "$( groups $agent_user | grep "\bsudo\b" )" != "" ] if [ -f "/usr/bin/sudo" ] && [ "$( groups $agent_user | grep "\bsudo\b" )" != "" ]
then then
sudo /etc/init.d/ogp_agent ${1:-''} sudo /etc/init.d/agent ${1:-''}
exit exit
else else
echo "Permission denied." echo "Permission denied."
@ -32,9 +32,9 @@ then
fi fi
start() { start() {
echo -n "Starting OGP Agent: " echo -n "Starting Game Server Agent: "
if [ -e "$agent_dir/ogp_agent_run.pid" ]; then if [ -e "$agent_dir/agent_run.pid" ]; then
PID=`cat $agent_dir/ogp_agent_run.pid` PID=`cat $agent_dir/agent_run.pid`
RET=$(kill -s 0 $PID &> /dev/null; echo $?) RET=$(kill -s 0 $PID &> /dev/null; echo $?)
if [ $RET -eq 0 ]; then if [ $RET -eq 0 ]; then
echo -n "already running." echo -n "already running."
@ -100,22 +100,22 @@ start() {
fi fi
cd $agent_dir cd $agent_dir
su -c "screen -d -m -t ogp_agent -c ogp_screenrc -S ogp_agent ./ogp_agent_run -pidfile ogp_agent_run.pid" $agent_user &> $agent_dir/ogp_agent.svc & su -c "screen -d -m -t agent -c screenrc -S agent ./agent_run -pidfile agent_run.pid" $agent_user &> $agent_dir/agent.svc &
echo -n "started successfully." echo -n "started successfully."
bold=`tput bold` bold=`tput bold`
normal=`tput sgr0` normal=`tput sgr0`
echo echo
echo "Use ${bold}sudo su -c 'screen -S ogp_agent -r' $agent_user${normal} to attach the agent screen," echo "Use ${bold}sudo su -c 'screen -S agent -r' $agent_user${normal} to attach the agent screen,"
echo "and ${bold}ctrl+A+D${normal} to detach it." echo "and ${bold}ctrl+A+D${normal} to detach it."
return 0 return 0
} }
stop() { stop() {
# Stop daemon # Stop daemon
echo -n "Stopping OGP Agent: " echo -n "Stopping Game Server Agent: "
if [ -f $agent_dir/ogp_agent_run.pid ] if [ -f $agent_dir/agent_run.pid ]
then then
PID=`cat $agent_dir/ogp_agent_run.pid` PID=`cat $agent_dir/agent_run.pid`
RET=$(kill $PID &> /dev/null; echo $?) RET=$(kill $PID &> /dev/null; echo $?)
if [ $RET -ne 0 ]; then if [ $RET -ne 0 ]; then
echo -n "not running." echo -n "not running."
@ -123,7 +123,7 @@ stop() {
echo -n "stopped successfully." echo -n "stopped successfully."
fi fi
else else
echo -n "PID file not found ($agent_dir/ogp_agent_run.pid)" echo -n "PID file not found ($agent_dir/agent_run.pid)"
fi fi
echo echo
return 0 return 0
@ -145,7 +145,7 @@ case "$1" in
RETVAL=$? RETVAL=$?
;; ;;
*) *)
echo "Usage: service ogp_agent start|stop|restart" echo "Usage: service agent start|stop|restart"
RETVAL=1 RETVAL=1
echo echo
;; ;;

View file

@ -1,16 +1,15 @@
# ogp_agent systemd Service Script # Game Server Agent systemd Service Script
# By Open Game Panel # By Game Server Panel
# OGP <own3mall@gmail.com>
[Unit] [Unit]
Description=Open Game Panel (OGP) Daemon www.opengamepanel.org Description=Game Server Agent Daemon
After=network.target After=network.target
[Service] [Service]
Type=oneshot Type=oneshot
ExecStart=/bin/sh -c "{OGP_AGENT_PATH}/ogp_agent_init start" ExecStart=/bin/sh -c "{OGP_AGENT_PATH}/agent_init start"
ExecStop=/bin/sh -c "{OGP_AGENT_PATH}/ogp_agent_init stop" ExecStop=/bin/sh -c "{OGP_AGENT_PATH}/agent_init stop"
RemainAfterExit=yes RemainAfterExit=yes
PIDFile="{OGP_AGENT_PATH}/ogp_agent_run.pid" PIDFile="{OGP_AGENT_PATH}/agent_run.pid"
[Install] [Install]
WantedBy=multi-user.target WantedBy=multi-user.target

View file

@ -175,7 +175,7 @@ then
echo "Writing Config file - $cfgfile" echo "Writing Config file - $cfgfile"
echo "%Cfg::Config = ( echo "%Cfg::Config = (
logfile => '${agent_home}/ogp_agent.log', logfile => '${agent_home}/agent.log',
listen_port => '${port}', listen_port => '${port}',
listen_ip => '${ip}', listen_ip => '${ip}',
version => '${AGENT_VERSION}', version => '${AGENT_VERSION}',
@ -489,7 +489,7 @@ then
fi fi
ftpd_user=$(grep -oP '^User\s+\K.+' ${proFTPdConfFile}) ftpd_user=$(grep -oP '^User\s+\K.+' ${proFTPdConfFile})
ftpd_group=$(grep -oP '^Group\s+\K.+' ${proFTPdConfFile}) ftpd_group=$(grep -oP '^Group\s+\K.+' ${proFTPdConfFile})
agent_user=$(grep -oP 'agent_user=\K.+' /etc/init.d/ogp_agent) agent_user=$(grep -oP 'agent_user=\K.+' /etc/init.d/agent)
if [ ! -z "$ftpd_user" ] && [ ! -z "$ftpd_group" ] && [ ! -z "$agent_user" ] if [ ! -z "$ftpd_user" ] && [ ! -z "$ftpd_group" ] && [ ! -z "$agent_user" ]
then then
if [ "$(groups $agent_user|grep $ftpd_group)" == "" ] if [ "$(groups $agent_user|grep $ftpd_group)" == "" ]

View file

@ -510,7 +510,7 @@ function api_user_games()
} }
} }
else else
$game_path = "/home/".$remote_server['ogp_user']."/OGP_User_Files/"; // Default $game_path = "/home/".$remote_server['ogp_user']."/User_Files/"; // Default
$game_path = clean_path($game_path); // Clean it $game_path = clean_path($game_path); // Clean it
@ -611,7 +611,7 @@ function api_user_games()
} }
} }
else else
$game_path = "/home/".$game_home['ogp_user']."/OGP_User_Files/"; // Default $game_path = "/home/".$game_home['ogp_user']."/User_Files/"; // Default
$game_path = clean_path($game_path); // Clean it $game_path = clean_path($game_path); // Clean it
@ -1212,7 +1212,7 @@ function api_gamemanager()
$postInstallCMD = ""; $postInstallCMD = "";
if(isset($server_xml->post_install)) if(isset($server_xml->post_install))
$postInstallCMD .= $server_xml->post_install; $postInstallCMD .= $server_xml->post_install;
$postInstallCMD .= "\n{OGP_LOCK_FILE} " . $home_info['home_path'] . "/" . ($server_xml->exe_location ? $server_xml->exe_location . "/" : "") . $server_xml->server_exec_name; $postInstallCMD .= "\n{LOCK_FILE} " . $home_info['home_path'] . "/" . ($server_xml->exe_location ? $server_xml->exe_location . "/" : "") . $server_xml->server_exec_name;
$remote->steam_cmd($home_info['home_id'],$home_info['home_path'],$installer_name,$modname, $remote->steam_cmd($home_info['home_id'],$home_info['home_path'],$installer_name,$modname,
$betaname,$betapwd,$login,$pass,$settings['steam_guard'], $betaname,$betapwd,$login,$pass,$settings['steam_guard'],
@ -1320,7 +1320,7 @@ function api_gamemanager()
$postInstallCMD = ""; $postInstallCMD = "";
if(isset($server_xml->post_install)) if(isset($server_xml->post_install))
$postInstallCMD .= $server_xml->post_install; $postInstallCMD .= $server_xml->post_install;
$postInstallCMD .= "\n{OGP_LOCK_FILE} " . $home_info['home_path'] . "/" . ($server_xml->exe_location ? $server_xml->exe_location . "/" : "") . $server_xml->server_exec_name; $postInstallCMD .= "\n{LOCK_FILE} " . $home_info['home_path'] . "/" . ($server_xml->exe_location ? $server_xml->exe_location . "/" : "") . $server_xml->server_exec_name;
$remote->start_rsync_install($home_id,$home_info['home_path'],"$full_url",$exec_folder_path,$exec_path,$preInstallCMD,$postInstallCMD); $remote->start_rsync_install($home_id,$home_info['home_path'],"$full_url",$exec_folder_path,$exec_path,$preInstallCMD,$postInstallCMD);
$status = "200"; $status = "200";
@ -1343,7 +1343,7 @@ function api_gamemanager()
$postInstallCMD = ""; $postInstallCMD = "";
if(isset($server_xml->post_install)) if(isset($server_xml->post_install))
$postInstallCMD .= $server_xml->post_install; $postInstallCMD .= $server_xml->post_install;
$postInstallCMD .= "\n{OGP_LOCK_FILE} " . $home_info['home_path'] . "/" . ($server_xml->exe_location ? $server_xml->exe_location . "/" : "") . $server_xml->server_exec_name; $postInstallCMD .= "\n{LOCK_FILE} " . $home_info['home_path'] . "/" . ($server_xml->exe_location ? $server_xml->exe_location . "/" : "") . $server_xml->server_exec_name;
$remote->start_file_download($manual_url,$home_info['home_path'],$filename,"uncompress",$postInstallCMD); $remote->start_file_download($manual_url,$home_info['home_path'],$filename,"uncompress",$postInstallCMD);
$status = "200"; $status = "200";
$message = "Manual installation started"; $message = "Manual installation started";
@ -1371,7 +1371,7 @@ function api_gamemanager()
$postInstallCMD = ""; $postInstallCMD = "";
if(isset($server_xml->post_install)) if(isset($server_xml->post_install))
$postInstallCMD .= $server_xml->post_install; $postInstallCMD .= $server_xml->post_install;
$postInstallCMD .= "\n{OGP_LOCK_FILE} " . $home_info['home_path'] . "/" . ($server_xml->exe_location ? $server_xml->exe_location . "/" : "") . $server_xml->server_exec_name; $postInstallCMD .= "\n{LOCK_FILE} " . $home_info['home_path'] . "/" . ($server_xml->exe_location ? $server_xml->exe_location . "/" : "") . $server_xml->server_exec_name;
$remote->masterServerUpdate($home_id,$home_info['home_path'],$ms_home_id,$ms_info['home_path'],$exec_folder_path,$exec_path,$preInstallCMD,$postInstallCMD); $remote->masterServerUpdate($home_id,$home_info['home_path'],$ms_home_id,$ms_info['home_path'],$exec_folder_path,$exec_path,$preInstallCMD,$postInstallCMD);
$status = "200"; $status = "200";