From 08f83918f1a771bd16450d7c5d77e9881aa390b0 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 5 Sep 2025 23:02:41 +0000 Subject: [PATCH] Fix server offline issue by updating OGP references to match agent changes Co-authored-by: iaretechnician <2749183+iaretechnician@users.noreply.github.com> --- _agent-linux/agent_conf.sh | 4 +-- _agent-linux/includes/ogp_agent.init | 8 +++--- _agent-linux/includes/ogp_agent.init.dbn | 18 ++++++------- _agent-linux/includes/ogp_agent.init.gentoo | 12 ++++----- _agent-linux/includes/ogp_agent.init.rh | 28 ++++++++++----------- _agent-linux/systemd/ogp_agent.service | 13 +++++----- _agent-windows/agent_conf.sh | 4 +-- ogp_api.php | 12 ++++----- 8 files changed, 49 insertions(+), 50 deletions(-) diff --git a/_agent-linux/agent_conf.sh b/_agent-linux/agent_conf.sh index 776674b3..659a7cf0 100644 --- a/_agent-linux/agent_conf.sh +++ b/_agent-linux/agent_conf.sh @@ -195,7 +195,7 @@ then echo "Writing Config file - $cfgfile" echo "%Cfg::Config = ( - logfile => '${agent_home}/ogp_agent.log', + logfile => '${agent_home}/agent.log', listen_port => '${port}', listen_ip => '${ip}', version => '${AGENT_VERSION}', @@ -521,7 +521,7 @@ then ftpd_user=$(grep -oP '^User\s+\K.+' ${proFTPdConfFile}) ftpd_group=$(grep -oP '^Group\s+\K.+' ${proFTPdConfFile}) 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 if [ ! -z "$ftpd_user" ] && [ ! -z "$ftpd_group" ] && [ ! -z "$agent_user" ] then diff --git a/_agent-linux/includes/ogp_agent.init b/_agent-linux/includes/ogp_agent.init index 6da28141..30d16318 100644 --- a/_agent-linux/includes/ogp_agent.init +++ b/_agent-linux/includes/ogp_agent.init @@ -7,16 +7,16 @@ agent_user=OGP_USER # Start function. start() { - echo "Starting OGP Agent..." + echo "Starting Game Server Agent..." 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 } # Stop function. stop() { - echo "Stopping OGP Agent..." - kill `cat $agent_dir/ogp_agent_run.pid` + echo "Stopping Game Server Agent..." + kill `cat $agent_dir/agent_run.pid` } restart() { diff --git a/_agent-linux/includes/ogp_agent.init.dbn b/_agent-linux/includes/ogp_agent.init.dbn index 4aa247e7..2b165be3 100644 --- a/_agent-linux/includes/ogp_agent.init.dbn +++ b/_agent-linux/includes/ogp_agent.init.dbn @@ -1,15 +1,15 @@ #!/bin/bash # ### BEGIN INIT INFO -# Provides: ogp_agent +# Provides: agent # Required-Start: $all # Required-Stop: $all # Should-Start: $all # Should-Stop: $all # Default-Start: 2 3 4 5 # Default-Stop: 0 1 6 -# Short-Description: Start and stop the OGP Agent -# Description: Start and stop the OGP Agent +# Short-Description: Start and stop the Game Server Agent +# Description: Start and stop the Game Server Agent ### END INIT INFO # @@ -26,9 +26,9 @@ then fi start() { - if [ -e "$agent_dir/ogp_agent_run.pid" ] + if [ -e "$agent_dir/agent_run.pid" ] then - pid=$(cat $agent_dir/ogp_agent_run.pid) + pid=$(cat $agent_dir/agent_run.pid) out=$(kill -0 $pid > /dev/null 2>&1) if [ $? == 0 ] then @@ -90,14 +90,14 @@ start() { fi 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 } stop() { - if [ -e "$agent_dir/ogp_agent_run.pid" ] + if [ -e "$agent_dir/agent_run.pid" ] then - pid=$(cat $agent_dir/ogp_agent_run.pid) + pid=$(cat $agent_dir/agent_run.pid) kill -0 $pid > /dev/null 2>&1 if [ $? == 0 ] then @@ -126,7 +126,7 @@ case "${1:-''}" in RETVAL=$? ;; *) - echo "Usage: service ogp_agent start|stop|restart" + echo "Usage: service agent start|stop|restart" exit 1 ;; esac diff --git a/_agent-linux/includes/ogp_agent.init.gentoo b/_agent-linux/includes/ogp_agent.init.gentoo index eaaf0ace..db3e686f 100644 --- a/_agent-linux/includes/ogp_agent.init.gentoo +++ b/_agent-linux/includes/ogp_agent.init.gentoo @@ -12,14 +12,14 @@ depend() { } start() { - ebegin "Starting OGP 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 - eend $? "Failed to start 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 agent -c screenrc -S agent ./agent_run -pidfile agent_run.pid + eend $? "Failed to start Game Server Agent" } stop() { - ebegin "Stopping OGP Agent" - start-stop-daemon --stop --quiet --pidfile $agent_dir/ogp_agent_run.pid - eend $? "Failed to stop OGP Agent" + ebegin "Stopping Game Server Agent" + start-stop-daemon --stop --quiet --pidfile $agent_dir/agent_run.pid + eend $? "Failed to stop Game Server Agent" } diff --git a/_agent-linux/includes/ogp_agent.init.rh b/_agent-linux/includes/ogp_agent.init.rh index ec6b4e82..b72a7b98 100644 --- a/_agent-linux/includes/ogp_agent.init.rh +++ b/_agent-linux/includes/ogp_agent.init.rh @@ -1,16 +1,16 @@ #!/bin/sh # -# Startup/shutdown script for the OGP Agent. +# Startup/shutdown script for the Game Server Agent. # # Linux chkconfig stuff: # # 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_user=OGP_USER -service=ogp_agent +service=agent # Source function library. if [ -f /etc/rc.d/init.d/functions ] ; then @@ -23,7 +23,7 @@ if [ "$( whoami )" != "root" ] then if [ -f "/usr/bin/sudo" ] && [ "$( groups $agent_user | grep "\bsudo\b" )" != "" ] then - sudo /etc/init.d/ogp_agent ${1:-''} + sudo /etc/init.d/agent ${1:-''} exit else echo "Permission denied." @@ -32,9 +32,9 @@ then fi start() { - echo -n "Starting OGP Agent: " - if [ -e "$agent_dir/ogp_agent_run.pid" ]; then - PID=`cat $agent_dir/ogp_agent_run.pid` + echo -n "Starting Game Server Agent: " + if [ -e "$agent_dir/agent_run.pid" ]; then + PID=`cat $agent_dir/agent_run.pid` RET=$(kill -s 0 $PID &> /dev/null; echo $?) if [ $RET -eq 0 ]; then echo -n "already running." @@ -100,22 +100,22 @@ start() { fi 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." bold=`tput bold` normal=`tput sgr0` 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." return 0 } stop() { # Stop daemon - echo -n "Stopping OGP Agent: " - if [ -f $agent_dir/ogp_agent_run.pid ] + echo -n "Stopping Game Server Agent: " + if [ -f $agent_dir/agent_run.pid ] then - PID=`cat $agent_dir/ogp_agent_run.pid` + PID=`cat $agent_dir/agent_run.pid` RET=$(kill $PID &> /dev/null; echo $?) if [ $RET -ne 0 ]; then echo -n "not running." @@ -123,7 +123,7 @@ stop() { echo -n "stopped successfully." fi 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 echo return 0 @@ -145,7 +145,7 @@ case "$1" in RETVAL=$? ;; *) - echo "Usage: service ogp_agent start|stop|restart" + echo "Usage: service agent start|stop|restart" RETVAL=1 echo ;; diff --git a/_agent-linux/systemd/ogp_agent.service b/_agent-linux/systemd/ogp_agent.service index d56715d8..949ea11d 100644 --- a/_agent-linux/systemd/ogp_agent.service +++ b/_agent-linux/systemd/ogp_agent.service @@ -1,16 +1,15 @@ -# ogp_agent systemd Service Script -# By Open Game Panel -# OGP +# Game Server Agent systemd Service Script +# By Game Server Panel [Unit] -Description=Open Game Panel (OGP) Daemon www.opengamepanel.org +Description=Game Server Agent Daemon After=network.target [Service] Type=oneshot -ExecStart=/bin/sh -c "{OGP_AGENT_PATH}/ogp_agent_init start" -ExecStop=/bin/sh -c "{OGP_AGENT_PATH}/ogp_agent_init stop" +ExecStart=/bin/sh -c "{OGP_AGENT_PATH}/agent_init start" +ExecStop=/bin/sh -c "{OGP_AGENT_PATH}/agent_init stop" RemainAfterExit=yes -PIDFile="{OGP_AGENT_PATH}/ogp_agent_run.pid" +PIDFile="{OGP_AGENT_PATH}/agent_run.pid" [Install] WantedBy=multi-user.target diff --git a/_agent-windows/agent_conf.sh b/_agent-windows/agent_conf.sh index 10bf92dc..6bdf5312 100644 --- a/_agent-windows/agent_conf.sh +++ b/_agent-windows/agent_conf.sh @@ -175,7 +175,7 @@ then echo "Writing Config file - $cfgfile" echo "%Cfg::Config = ( - logfile => '${agent_home}/ogp_agent.log', + logfile => '${agent_home}/agent.log', listen_port => '${port}', listen_ip => '${ip}', version => '${AGENT_VERSION}', @@ -489,7 +489,7 @@ then fi ftpd_user=$(grep -oP '^User\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" ] then if [ "$(groups $agent_user|grep $ftpd_group)" == "" ] diff --git a/ogp_api.php b/ogp_api.php index c1677a20..9f062f47 100644 --- a/ogp_api.php +++ b/ogp_api.php @@ -510,7 +510,7 @@ function api_user_games() } } 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 @@ -611,7 +611,7 @@ function api_user_games() } } 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 @@ -1212,7 +1212,7 @@ function api_gamemanager() $postInstallCMD = ""; if(isset($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, $betaname,$betapwd,$login,$pass,$settings['steam_guard'], @@ -1320,7 +1320,7 @@ function api_gamemanager() $postInstallCMD = ""; if(isset($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); $status = "200"; @@ -1343,7 +1343,7 @@ function api_gamemanager() $postInstallCMD = ""; if(isset($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); $status = "200"; $message = "Manual installation started"; @@ -1371,7 +1371,7 @@ function api_gamemanager() $postInstallCMD = ""; if(isset($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); $status = "200";