cleanup
This commit is contained in:
parent
3d93d01cd1
commit
7665d702a2
22 changed files with 97 additions and 132 deletions
|
|
@ -2,10 +2,8 @@
|
||||||
screen_log_local => '1',
|
screen_log_local => '1',
|
||||||
delete_logs_after => '30',
|
delete_logs_after => '30',
|
||||||
gsp_manages_ftp => '1',
|
gsp_manages_ftp => '1',
|
||||||
ogp_manages_ftp => '1',
|
|
||||||
ftp_method => 'PureFTPd',
|
ftp_method => 'PureFTPd',
|
||||||
gsp_autorestart_server => '1',
|
gsp_autorestart_server => '1',
|
||||||
ogp_autorestart_server => '1',
|
|
||||||
protocol_shutdown_waittime => '10',
|
protocol_shutdown_waittime => '10',
|
||||||
linux_user_per_game_server => '1',
|
linux_user_per_game_server => '1',
|
||||||
PortValidationEnabled => '1',
|
PortValidationEnabled => '1',
|
||||||
|
|
|
||||||
|
|
@ -2,10 +2,8 @@
|
||||||
screen_log_local => '1',
|
screen_log_local => '1',
|
||||||
delete_logs_after => '30',
|
delete_logs_after => '30',
|
||||||
gsp_manages_ftp => '1',
|
gsp_manages_ftp => '1',
|
||||||
ogp_manages_ftp => '1',
|
|
||||||
ftp_method => 'PureFTPd',
|
ftp_method => 'PureFTPd',
|
||||||
gsp_autorestart_server => '1',
|
gsp_autorestart_server => '1',
|
||||||
ogp_autorestart_server => '1',
|
|
||||||
protocol_shutdown_waittime => '10',
|
protocol_shutdown_waittime => '10',
|
||||||
linux_user_per_game_server => '1',
|
linux_user_per_game_server => '1',
|
||||||
PortValidationEnabled => '1',
|
PortValidationEnabled => '1',
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
agent_auto_update=0
|
agent_auto_update=0
|
||||||
agent_update_repo_url=http://forge.runlevelsystems.com/dev/GSP.git
|
agent_update_repo_url=http://forge.runlevelsystems.com/dev/GSP.git
|
||||||
agent_update_branch=Panel-unstable
|
agent_update_branch=Panel-unstable
|
||||||
agent_update_raw_url=http://forge.runlevelsystems.com/dev/GSP/raw/branch/Panel-unstable/Agent-Linux/ogp_agent.pl
|
agent_update_raw_url=http://forge.runlevelsystems.com/dev/GSP/raw/branch/Panel-unstable/Agent-Linux/gsp_agent.pl
|
||||||
run_pureftpd=1
|
run_pureftpd=1
|
||||||
ftp_port=21
|
ftp_port=21
|
||||||
ftp_ip=0.0.0.0
|
ftp_ip=0.0.0.0
|
||||||
|
|
|
||||||
|
|
@ -2,4 +2,4 @@ GSP Agent NOTES:
|
||||||
|
|
||||||
Before committing code it is recommended to execute perltidy:
|
Before committing code it is recommended to execute perltidy:
|
||||||
|
|
||||||
$ perltidy -b -gnu ogp_agent.pl
|
$ perltidy -b -gnu gsp_agent.pl
|
||||||
|
|
|
||||||
|
|
@ -25,7 +25,7 @@ if (isset($_GET['password'])) {
|
||||||
|
|
||||||
if (!isset($ftp_username) || !isset($ftp_pass)) {
|
if (!isset($ftp_username) || !isset($ftp_pass)) {
|
||||||
$errorCount++;
|
$errorCount++;
|
||||||
$errors[] = "No FTP accounts could be modified! Updated username and password were not sent by the OGP upload functions.";
|
$errors[] = "No FTP accounts could be modified! Updated username and password were not sent by the GSP upload functions.";
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
if ($errorCount == 0) {
|
if ($errorCount == 0) {
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
package Frontier::Daemon::OGP::Forking;
|
package Frontier::Daemon::GSP::Forking;
|
||||||
# $Id: Forking.pm,v 1.6 2004/01/23 19:48:33 tcaine Exp $
|
# $Id: Forking.pm,v 1.6 2004/01/23 19:48:33 tcaine Exp $
|
||||||
|
|
||||||
use strict;
|
use strict;
|
||||||
|
|
@ -14,7 +14,7 @@ use HTTP::Status;
|
||||||
|
|
||||||
# most of this routine comes directly from Frontier::Daemon
|
# most of this routine comes directly from Frontier::Daemon
|
||||||
sub new {
|
sub new {
|
||||||
my $class = shift;
|
my $class = shift;
|
||||||
my %args = @_;
|
my %args = @_;
|
||||||
my $encoding = delete $args{encoding};
|
my $encoding = delete $args{encoding};
|
||||||
my $self = $class->SUPER::new( %args );
|
my $self = $class->SUPER::new( %args );
|
||||||
|
|
@ -39,14 +39,14 @@ ACCEPT:
|
||||||
if ( not defined $pid ) {
|
if ( not defined $pid ) {
|
||||||
warn "fork() failed: $!";
|
warn "fork() failed: $!";
|
||||||
$conn = undef;
|
$conn = undef;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
my $request = $conn->get_request;
|
my $request = $conn->get_request;
|
||||||
if ($request) {
|
if ($request) {
|
||||||
if ($request->method eq 'POST' && $request->url->path eq '/RPC2') {
|
if ($request->method eq 'POST' && $request->url->path eq '/RPC2') {
|
||||||
${*$self}{'response'}->content(
|
${*$self}{'response'}->content(
|
||||||
${*$self}{'decode'}->serve(
|
${*$self}{'decode'}->serve(
|
||||||
$request->content,
|
$request->content,
|
||||||
${*$self}{'methods'},
|
${*$self}{'methods'},
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
@ -6,19 +6,19 @@ Perl-based Linux execution agent for GameServer Panel. The agent receives signed
|
||||||
|
|
||||||
- install directory: `/home/gameserver/GSP`
|
- install directory: `/home/gameserver/GSP`
|
||||||
- run script: `gsp_agent_run`
|
- run script: `gsp_agent_run`
|
||||||
- legacy run wrapper: `ogp_agent_run`
|
- legacy run wrapper: `gsp_agent_run`
|
||||||
- systemd service: `gsp_agent.service`
|
- systemd service: `gsp_agent.service`
|
||||||
- config directory: `/home/gameserver/GSP/Cfg/`
|
- config directory: `/home/gameserver/GSP/Cfg/`
|
||||||
- main log: `/home/gameserver/GSP/gsp_agent.log`
|
- main log: `/home/gameserver/GSP/gsp_agent.log`
|
||||||
- screen logs: `/home/gameserver/GSP/screenlogs/`
|
- screen logs: `/home/gameserver/GSP/screenlogs/`
|
||||||
- server-content runtime: `/home/gameserver/GSP/_gsp_content/`
|
- server-content runtime: `/home/gameserver/GSP/_gsp_content/`
|
||||||
|
|
||||||
Legacy OGP script names are retained only where the Panel or older installs may still expect them.
|
Legacy GSP script names are retained only where the Panel or older installs may still expect them.
|
||||||
|
|
||||||
## Guided Install
|
## Guided Install
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
chmod +x install_agent_prereqs.sh install.sh agent_conf.sh gsp_agent_run ogp_agent_run
|
chmod +x install_agent_prereqs.sh install.sh agent_conf.sh gsp_agent_run gsp_agent_run
|
||||||
sudo ./install_agent_prereqs.sh
|
sudo ./install_agent_prereqs.sh
|
||||||
sudo ./install.sh
|
sudo ./install.sh
|
||||||
```
|
```
|
||||||
|
|
|
||||||
|
|
@ -24,7 +24,7 @@ Options:
|
||||||
--listen-ip IP Agent bind IP. Default: ${DEFAULT_IP}
|
--listen-ip IP Agent bind IP. Default: ${DEFAULT_IP}
|
||||||
--listen-port PORT Agent bind port. Default: ${DEFAULT_PORT}
|
--listen-port PORT Agent bind port. Default: ${DEFAULT_PORT}
|
||||||
--sudo-password VALUE Optional sudo password for legacy sudo_exec flows.
|
--sudo-password VALUE Optional sudo password for legacy sudo_exec flows.
|
||||||
--web-api-url URL Panel ogp_api.php URL.
|
--web-api-url URL Panel gsp_api.php URL.
|
||||||
--agent-event-url URL Panel agent_event_receiver.php URL.
|
--agent-event-url URL Panel agent_event_receiver.php URL.
|
||||||
--remote-server-id ID Panel remote server ID.
|
--remote-server-id ID Panel remote server ID.
|
||||||
--ftp-managed 0|1 Whether GSP should manage FTP accounts. Default: 1
|
--ftp-managed 0|1 Whether GSP should manage FTP accounts. Default: 1
|
||||||
|
|
@ -130,7 +130,7 @@ if [ "$guided" -eq 1 ]; then
|
||||||
key="${key:-$(ask_secret "Agent key/shared secret")}"
|
key="${key:-$(ask_secret "Agent key/shared secret")}"
|
||||||
listen_ip="$(ask "Listen IP" "$listen_ip")"
|
listen_ip="$(ask "Listen IP" "$listen_ip")"
|
||||||
listen_port="$(ask "Listen port" "$listen_port")"
|
listen_port="$(ask "Listen port" "$listen_port")"
|
||||||
web_api_url="$(ask "Panel API URL, usually https://panel.example.com/ogp_api.php" "$web_api_url")"
|
web_api_url="$(ask "Panel API URL, usually https://panel.example.com/gsp_api.php" "$web_api_url")"
|
||||||
agent_event_url="$(ask "Panel event receiver URL, usually https://panel.example.com/agent_event_receiver.php" "$agent_event_url")"
|
agent_event_url="$(ask "Panel event receiver URL, usually https://panel.example.com/agent_event_receiver.php" "$agent_event_url")"
|
||||||
remote_server_id="$(ask "Panel remote server ID" "$remote_server_id")"
|
remote_server_id="$(ask "Panel remote server ID" "$remote_server_id")"
|
||||||
ftp_managed="$(ask "Manage FTP accounts? 1=yes, 0=no" "$ftp_managed")"
|
ftp_managed="$(ask "Manage FTP accounts? 1=yes, 0=no" "$ftp_managed")"
|
||||||
|
|
@ -181,10 +181,8 @@ cat > "$prefsfile" <<EOF
|
||||||
screen_log_local => '${screen_log_local}',
|
screen_log_local => '${screen_log_local}',
|
||||||
delete_logs_after => '${delete_logs_after}',
|
delete_logs_after => '${delete_logs_after}',
|
||||||
gsp_manages_ftp => '${ftp_managed}',
|
gsp_manages_ftp => '${ftp_managed}',
|
||||||
ogp_manages_ftp => '${ftp_managed}',
|
|
||||||
ftp_method => '${ftp_method}',
|
ftp_method => '${ftp_method}',
|
||||||
gsp_autorestart_server => '${auto_restart}',
|
gsp_autorestart_server => '${auto_restart}',
|
||||||
ogp_autorestart_server => '${auto_restart}',
|
|
||||||
protocol_shutdown_waittime => '${protocol_shutdown_waittime}',
|
protocol_shutdown_waittime => '${protocol_shutdown_waittime}',
|
||||||
linux_user_per_game_server => '${linux_user_per_game_server}',
|
linux_user_per_game_server => '${linux_user_per_game_server}',
|
||||||
PortValidationEnabled => '1',
|
PortValidationEnabled => '1',
|
||||||
|
|
@ -197,7 +195,7 @@ cat > "$bashprefsfile" <<EOF
|
||||||
agent_auto_update=${auto_update}
|
agent_auto_update=${auto_update}
|
||||||
agent_update_repo_url=http://forge.runlevelsystems.com/dev/GSP.git
|
agent_update_repo_url=http://forge.runlevelsystems.com/dev/GSP.git
|
||||||
agent_update_branch=Panel-unstable
|
agent_update_branch=Panel-unstable
|
||||||
agent_update_raw_url=http://forge.runlevelsystems.com/dev/GSP/raw/branch/Panel-unstable/Agent-Linux/ogp_agent.pl
|
agent_update_raw_url=http://forge.runlevelsystems.com/dev/GSP/raw/branch/Panel-unstable/Agent-Linux/gsp_agent.pl
|
||||||
run_pureftpd=${ftp_managed}
|
run_pureftpd=${ftp_managed}
|
||||||
ftp_port=${ftp_port}
|
ftp_port=${ftp_port}
|
||||||
ftp_ip=${ftp_ip}
|
ftp_ip=${ftp_ip}
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,7 @@ New Linux installs default to:
|
||||||
- service: `gsp_agent.service`
|
- service: `gsp_agent.service`
|
||||||
- log file: `/home/gameserver/GSP/gsp_agent.log`
|
- log file: `/home/gameserver/GSP/gsp_agent.log`
|
||||||
|
|
||||||
Legacy names such as `ogp_agent_run` remain wrappers or protocol compatibility details only.
|
Legacy names such as `gsp_agent_run` remain wrappers or protocol compatibility details only.
|
||||||
|
|
||||||
## Legacy Workshop RPC
|
## Legacy Workshop RPC
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -28,7 +28,7 @@ The script may show normal `needrestart` output about services, kernels, or VM g
|
||||||
## Guided Installation
|
## Guided Installation
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
chmod +x install.sh agent_conf.sh gsp_agent_run ogp_agent_run
|
chmod +x install.sh agent_conf.sh gsp_agent_run gsp_agent_run
|
||||||
sudo ./install.sh
|
sudo ./install.sh
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
@ -76,8 +76,8 @@ Important `Preferences.pm` keys:
|
||||||
|
|
||||||
Compatibility aliases are still written for older panel/agent paths:
|
Compatibility aliases are still written for older panel/agent paths:
|
||||||
|
|
||||||
- `ogp_manages_ftp`
|
- `gsp_manages_ftp`
|
||||||
- `ogp_autorestart_server`
|
- `gsp_autorestart_server`
|
||||||
|
|
||||||
## Folder Layout
|
## Folder Layout
|
||||||
|
|
||||||
|
|
@ -136,7 +136,7 @@ Use noninteractive flags when automating:
|
||||||
--key CHANGE_ME \
|
--key CHANGE_ME \
|
||||||
--listen-ip 0.0.0.0 \
|
--listen-ip 0.0.0.0 \
|
||||||
--listen-port 12679 \
|
--listen-port 12679 \
|
||||||
--web-api-url https://panel.example.com/ogp_api.php \
|
--web-api-url https://panel.example.com/gsp_api.php \
|
||||||
--agent-event-url https://panel.example.com/agent_event_receiver.php \
|
--agent-event-url https://panel.example.com/agent_event_receiver.php \
|
||||||
--remote-server-id 1
|
--remote-server-id 1
|
||||||
```
|
```
|
||||||
|
|
@ -164,7 +164,7 @@ Polkit or systemctl authentication failure:
|
||||||
- do not start with a non-root partial install
|
- do not start with a non-root partial install
|
||||||
- inspect `sudo journalctl -u gsp_agent -f`
|
- inspect `sudo journalctl -u gsp_agent -f`
|
||||||
|
|
||||||
Wrong install path or old `/home/gameserver/OGP` log path:
|
Wrong install path or old `/home/gameserver/GSP` log path:
|
||||||
|
|
||||||
- rerun `./agent_conf.sh --guided --install-dir /home/gameserver/GSP`
|
- rerun `./agent_conf.sh --guided --install-dir /home/gameserver/GSP`
|
||||||
- confirm `Cfg/Config.pm` has `logfile => '/home/gameserver/GSP/gsp_agent.log'`
|
- confirm `Cfg/Config.pm` has `logfile => '/home/gameserver/GSP/gsp_agent.log'`
|
||||||
|
|
@ -179,7 +179,7 @@ Service failed:
|
||||||
|
|
||||||
- run `sudo systemctl status gsp_agent`
|
- run `sudo systemctl status gsp_agent`
|
||||||
- run `sudo journalctl -u gsp_agent -f`
|
- run `sudo journalctl -u gsp_agent -f`
|
||||||
- run `perl -c /home/gameserver/GSP/ogp_agent.pl`
|
- run `perl -c /home/gameserver/GSP/gsp_agent.pl`
|
||||||
|
|
||||||
Config missing or invalid:
|
Config missing or invalid:
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,7 @@
|
||||||
#!/usr/bin/perl
|
#!/usr/bin/perl
|
||||||
#
|
#
|
||||||
# GameServer Panel Linux Agent
|
# GameServer Panel Linux Agent
|
||||||
# Forked from the Open Game Panel agent.
|
# Copyright (C) 2008 - 2018 The GSP Development Team
|
||||||
# Copyright (C) 2008 - 2018 The OGP Development Team
|
|
||||||
#
|
#
|
||||||
# This program is free software; you can redistribute it and/or
|
# This program is free software; you can redistribute it and/or
|
||||||
# modify it under the terms of the GNU General Public License
|
# modify it under the terms of the GNU General Public License
|
||||||
|
|
@ -24,7 +23,7 @@ use strict;
|
||||||
|
|
||||||
use Cwd; # Fast way to get the current directory
|
use Cwd; # Fast way to get the current directory
|
||||||
use lib getcwd();
|
use lib getcwd();
|
||||||
use Frontier::Daemon::OGP::Forking; # Forking XML-RPC server
|
use Frontier::Daemon::GSP::Forking; # Forking XML-RPC server
|
||||||
use File::Copy; # Simple file copy functions
|
use File::Copy; # Simple file copy functions
|
||||||
use File::Copy::Recursive
|
use File::Copy::Recursive
|
||||||
qw(fcopy rcopy dircopy fmove rmove dirmove pathempty pathrmdir)
|
qw(fcopy rcopy dircopy fmove rmove dirmove pathempty pathrmdir)
|
||||||
|
|
@ -76,7 +75,7 @@ use constant SCREEN_LOG_LOCAL => $Cfg::Preferences{screen_log_local};
|
||||||
use constant DELETE_LOGS_AFTER => $Cfg::Preferences{delete_logs_after};
|
use constant DELETE_LOGS_AFTER => $Cfg::Preferences{delete_logs_after};
|
||||||
use constant LINUX_USER_PER_GAME_SERVER => $Cfg::Preferences{linux_user_per_game_server};
|
use constant LINUX_USER_PER_GAME_SERVER => $Cfg::Preferences{linux_user_per_game_server};
|
||||||
use constant AGENT_PID_FILE =>
|
use constant AGENT_PID_FILE =>
|
||||||
Path::Class::File->new(AGENT_RUN_DIR, 'ogp_agent.pid');
|
Path::Class::File->new(AGENT_RUN_DIR, 'gsp_agent.pid');
|
||||||
use constant AGENT_RSYNC_GENERIC_LOG =>
|
use constant AGENT_RSYNC_GENERIC_LOG =>
|
||||||
Path::Class::File->new(AGENT_RUN_DIR, 'rsync_update_generic.log');
|
Path::Class::File->new(AGENT_RUN_DIR, 'rsync_update_generic.log');
|
||||||
use constant STEAM_LICENSE_OK => "Accept";
|
use constant STEAM_LICENSE_OK => "Accept";
|
||||||
|
|
@ -97,14 +96,14 @@ use constant AGENT_EVENTS_DIR =>
|
||||||
use constant AGENT_EVENT_QUEUE_FILE =>
|
use constant AGENT_EVENT_QUEUE_FILE =>
|
||||||
Path::Class::File->new(AGENT_EVENTS_DIR, 'pending-events.jsonl');
|
Path::Class::File->new(AGENT_EVENTS_DIR, 'pending-events.jsonl');
|
||||||
use constant SCREENRC_FILE =>
|
use constant SCREENRC_FILE =>
|
||||||
Path::Class::File->new(AGENT_RUN_DIR, 'ogp_screenrc');
|
Path::Class::File->new(AGENT_RUN_DIR, 'gsp_screenrc');
|
||||||
use constant SCREENRC_FILE_BK =>
|
use constant SCREENRC_FILE_BK =>
|
||||||
Path::Class::File->new(AGENT_RUN_DIR, 'ogp_screenrc_bk');
|
Path::Class::File->new(AGENT_RUN_DIR, 'gsp_screenrc_bk');
|
||||||
use constant SCREENRC_TMP_FILE =>
|
use constant SCREENRC_TMP_FILE =>
|
||||||
Path::Class::File->new(AGENT_RUN_DIR, 'ogp_screenrc.tmp');
|
Path::Class::File->new(AGENT_RUN_DIR, 'gsp_screenrc.tmp');
|
||||||
use constant SCREEN_TYPE_HOME => "HOME";
|
use constant SCREEN_TYPE_HOME => "HOME";
|
||||||
use constant SCREEN_TYPE_UPDATE => "UPDATE";
|
use constant SCREEN_TYPE_UPDATE => "UPDATE";
|
||||||
use constant SERVER_RUNNER_USER => "ogp_server_runner";
|
use constant SERVER_RUNNER_USER => "gsp_server_runner";
|
||||||
use constant FD_DIR => Path::Class::Dir->new(AGENT_RUN_DIR, 'FastDownload');
|
use constant FD_DIR => Path::Class::Dir->new(AGENT_RUN_DIR, 'FastDownload');
|
||||||
use constant FD_ALIASES_DIR => Path::Class::Dir->new(FD_DIR, 'aliases');
|
use constant FD_ALIASES_DIR => Path::Class::Dir->new(FD_DIR, 'aliases');
|
||||||
use constant FD_PID_FILE => Path::Class::File->new(FD_DIR, 'fd.pid');
|
use constant FD_PID_FILE => Path::Class::File->new(FD_DIR, 'fd.pid');
|
||||||
|
|
@ -187,7 +186,7 @@ sub agent_event_panel_url
|
||||||
if(defined($Cfg::Config{web_api_url}) && $Cfg::Config{web_api_url} ne "")
|
if(defined($Cfg::Config{web_api_url}) && $Cfg::Config{web_api_url} ne "")
|
||||||
{
|
{
|
||||||
my $url = $Cfg::Config{web_api_url};
|
my $url = $Cfg::Config{web_api_url};
|
||||||
$url =~ s/ogp_api\.php(?:\?.*)?$/agent_event_receiver.php/;
|
$url =~ s/gsp_api\.php(?:\?.*)?$/agent_event_receiver.php/;
|
||||||
return $url if($url =~ /agent_event_receiver\.php$/);
|
return $url if($url =~ /agent_event_receiver\.php$/);
|
||||||
$url =~ s/\/+$//;
|
$url =~ s/\/+$//;
|
||||||
return "$url/agent_event_receiver.php";
|
return "$url/agent_event_receiver.php";
|
||||||
|
|
@ -227,7 +226,8 @@ sub cleanup_server_content_pid_group_without_decrypt
|
||||||
my ($pid_file, $wanted_role, $as_user) = @_;
|
my ($pid_file, $wanted_role, $as_user) = @_;
|
||||||
return if(!-f $pid_file);
|
return if(!-f $pid_file);
|
||||||
my @remaining;
|
my @remaining;
|
||||||
if(!open(my $in, '<', $pid_file))
|
my $in;
|
||||||
|
if(!open($in, '<', $pid_file))
|
||||||
{
|
{
|
||||||
logger "Could not read server content PID file $pid_file: $!";
|
logger "Could not read server content PID file $pid_file: $!";
|
||||||
return;
|
return;
|
||||||
|
|
@ -249,7 +249,7 @@ sub cleanup_server_content_pid_group_without_decrypt
|
||||||
sudo_exec_without_decrypt("kill -KILL $pid >/dev/null 2>&1 || true", $as_user);
|
sudo_exec_without_decrypt("kill -KILL $pid >/dev/null 2>&1 || true", $as_user);
|
||||||
next;
|
next;
|
||||||
}
|
}
|
||||||
push(@remaining, $original) if($role ne "watchdog" && $role ne "app");
|
push(@remaining, $original);
|
||||||
}
|
}
|
||||||
close($in);
|
close($in);
|
||||||
if(open(my $out, '>', $pid_file))
|
if(open(my $out, '>', $pid_file))
|
||||||
|
|
@ -706,7 +706,7 @@ if(-e Path::Class::File->new(FD_DIR, 'Settings.pm'))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
my $d = Frontier::Daemon::OGP::Forking->new(
|
my $d = Frontier::Daemon::GSP::Forking->new(
|
||||||
methods => {
|
methods => {
|
||||||
is_screen_running => \&is_screen_running,
|
is_screen_running => \&is_screen_running,
|
||||||
server_status => \&server_status,
|
server_status => \&server_status,
|
||||||
|
|
@ -919,13 +919,13 @@ sub get_home_pids
|
||||||
sub create_screen_id
|
sub create_screen_id
|
||||||
{
|
{
|
||||||
my ($screen_type, $home_id) = @_;
|
my ($screen_type, $home_id) = @_;
|
||||||
return sprintf("OGP_%s_%09d", $screen_type, $home_id);
|
return sprintf("GSP_%s_%09d", $screen_type, $home_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
sub create_screen_cmd
|
sub create_screen_cmd
|
||||||
{
|
{
|
||||||
my ($screen_id, $exec_cmd) = @_;
|
my ($screen_id, $exec_cmd) = @_;
|
||||||
$exec_cmd = replace_OGP_Env_Vars($screen_id, "", "", $exec_cmd);
|
$exec_cmd = replace_GSP_Env_Vars($screen_id, "", "", $exec_cmd);
|
||||||
return
|
return
|
||||||
sprintf('export WINEDEBUG="fixme-all" && export DISPLAY=:1 && screen -d -m -t "%1$s" -c ' . SCREENRC_FILE . ' -S %1$s %2$s',
|
sprintf('export WINEDEBUG="fixme-all" && export DISPLAY=:1 && screen -d -m -t "%1$s" -c ' . SCREENRC_FILE . ' -S %1$s %2$s',
|
||||||
$screen_id, $exec_cmd);
|
$screen_id, $exec_cmd);
|
||||||
|
|
@ -937,7 +937,7 @@ sub create_screen_cmd_loop
|
||||||
my ($screen_id, $exec_cmd, $envVars, $skipLoop, $status_hint_file) = @_;
|
my ($screen_id, $exec_cmd, $envVars, $skipLoop, $status_hint_file) = @_;
|
||||||
my $server_start_bashfile = $screen_id . "_startup_scr.sh";
|
my $server_start_bashfile = $screen_id . "_startup_scr.sh";
|
||||||
|
|
||||||
$exec_cmd = replace_OGP_Env_Vars($screen_id, "", "", $exec_cmd);
|
$exec_cmd = replace_GSP_Env_Vars($screen_id, "", "", $exec_cmd);
|
||||||
|
|
||||||
# Allow file to be overwritten
|
# Allow file to be overwritten
|
||||||
if(-e $server_start_bashfile){
|
if(-e $server_start_bashfile){
|
||||||
|
|
@ -1004,8 +1004,8 @@ sub create_screen_cmd_loop
|
||||||
sub handle_lock_command_line{
|
sub handle_lock_command_line{
|
||||||
my ($command) = @_;
|
my ($command) = @_;
|
||||||
if(defined $command && $command ne ""){
|
if(defined $command && $command ne ""){
|
||||||
if ($command =~ m/{OGP_LOCK_FILE}/) {
|
if ($command =~ m/{GSP_LOCK_FILE}/) {
|
||||||
$command =~ s/{OGP_LOCK_FILE}\s*//g;
|
$command =~ s/{GSP_LOCK_FILE}\s*//g;
|
||||||
return secure_path_without_decrypt("chattr+i", $command);
|
return secure_path_without_decrypt("chattr+i", $command);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1013,7 +1013,7 @@ sub handle_lock_command_line{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
sub replace_OGP_Env_Vars{
|
sub replace_GSP_Env_Vars{
|
||||||
# This function replaces constants from environment variables set in the XML
|
# This function replaces constants from environment variables set in the XML
|
||||||
my ($screen_id, $homeid, $homepath, $exec_cmd, $game_key) = @_;
|
my ($screen_id, $homeid, $homepath, $exec_cmd, $game_key) = @_;
|
||||||
|
|
||||||
|
|
@ -1027,7 +1027,7 @@ sub replace_OGP_Env_Vars{
|
||||||
# If the install file exists, the game can be auto updated, else it will be ignored by the game for improper syntax
|
# If the install file exists, the game can be auto updated, else it will be ignored by the game for improper syntax
|
||||||
# To generate the install file, the "Install/Update via Steam" button must be clicked on at least once!
|
# To generate the install file, the "Install/Update via Steam" button must be clicked on at least once!
|
||||||
if(-e $fullPath){
|
if(-e $fullPath){
|
||||||
$exec_cmd =~ s/{OGP_STEAM_CMD_DIR}/$steamCMDPath/g;
|
$exec_cmd =~ s/{GSP_STEAM_CMD_DIR}/$steamCMDPath/g;
|
||||||
$exec_cmd =~ s/{STEAMCMD_INSTALL_FILE}/$steamInsFile/g;
|
$exec_cmd =~ s/{STEAMCMD_INSTALL_FILE}/$steamInsFile/g;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1035,7 +1035,7 @@ sub replace_OGP_Env_Vars{
|
||||||
|
|
||||||
# Handle home directory replacement
|
# Handle home directory replacement
|
||||||
if(defined $homepath && $homepath ne ""){
|
if(defined $homepath && $homepath ne ""){
|
||||||
$exec_cmd =~ s/{OGP_HOME_DIR}/$homepath/g;
|
$exec_cmd =~ s/{GSP_HOME_DIR}/$homepath/g;
|
||||||
}
|
}
|
||||||
|
|
||||||
# Handle global game shared directory replacement
|
# Handle global game shared directory replacement
|
||||||
|
|
@ -1047,7 +1047,7 @@ sub replace_OGP_Env_Vars{
|
||||||
{
|
{
|
||||||
logger "Could not create " . $shared_path . " directory $!.", 1;
|
logger "Could not create " . $shared_path . " directory $!.", 1;
|
||||||
}
|
}
|
||||||
$exec_cmd =~ s/{OGP_GAME_SHARED_DIR}/$shared_path/g;
|
$exec_cmd =~ s/{GSP_GAME_SHARED_DIR}/$shared_path/g;
|
||||||
}
|
}
|
||||||
|
|
||||||
return $exec_cmd;
|
return $exec_cmd;
|
||||||
|
|
@ -1573,12 +1573,12 @@ sub universal_start_without_decrypt
|
||||||
|
|
||||||
my $owner = SERVER_RUNNER_USER;
|
my $owner = SERVER_RUNNER_USER;
|
||||||
my $group = SERVER_RUNNER_USER;
|
my $group = SERVER_RUNNER_USER;
|
||||||
my $ogpAgentGroup = `whoami`;
|
my $gspAgentGroup = `whoami`;
|
||||||
|
|
||||||
my $screen_id = create_screen_id(SCREEN_TYPE_HOME, $home_id);
|
my $screen_id = create_screen_id(SCREEN_TYPE_HOME, $home_id);
|
||||||
my $status_hint_file = get_status_hint_path($home_id);
|
my $status_hint_file = get_status_hint_path($home_id);
|
||||||
|
|
||||||
chomp $ogpAgentGroup;
|
chomp $gspAgentGroup;
|
||||||
|
|
||||||
if(defined LINUX_USER_PER_GAME_SERVER && LINUX_USER_PER_GAME_SERVER eq "1"){
|
if(defined LINUX_USER_PER_GAME_SERVER && LINUX_USER_PER_GAME_SERVER eq "1"){
|
||||||
$owner = "gamehome" . $home_id;
|
$owner = "gamehome" . $home_id;
|
||||||
|
|
@ -1596,12 +1596,12 @@ sub universal_start_without_decrypt
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
# Fix perms on ogp_agent user's homedir so that other users can access their owned files within this dir
|
# Fix perms on the GSP agent user's homedir so other users can access owned files within this dir.
|
||||||
my $fixOGPHomeDirCommand = 'chmod -R ug+rwx $( getent passwd "' . $ogpAgentGroup . '" | cut -d: -f6 )';
|
my $fixGSPHomeDirCommand = 'chmod -R ug+rwx $( getent passwd "' . $gspAgentGroup . '" | cut -d: -f6 )';
|
||||||
sudo_exec_without_decrypt($fixOGPHomeDirCommand);
|
sudo_exec_without_decrypt($fixGSPHomeDirCommand);
|
||||||
|
|
||||||
$fixOGPHomeDirCommand = 'find "$( getent passwd "' . $ogpAgentGroup . '" | cut -d: -f6 )" -type d -print0 | xargs -0 chmod o+x';
|
$fixGSPHomeDirCommand = 'find "$( getent passwd "' . $gspAgentGroup . '" | cut -d: -f6 )" -type d -print0 | xargs -0 chmod o+x';
|
||||||
sudo_exec_without_decrypt($fixOGPHomeDirCommand);
|
sudo_exec_without_decrypt($fixGSPHomeDirCommand);
|
||||||
|
|
||||||
# Some game require that we are in the directory where the binary is.
|
# Some game require that we are in the directory where the binary is.
|
||||||
my $game_binary_dir = Path::Class::Dir->new($home_path, $run_dir);
|
my $game_binary_dir = Path::Class::Dir->new($home_path, $run_dir);
|
||||||
|
|
@ -1638,7 +1638,7 @@ sub universal_start_without_decrypt
|
||||||
my @prestartenvvars = split /[\r\n]+/, $envVars;
|
my @prestartenvvars = split /[\r\n]+/, $envVars;
|
||||||
my $envVarStr = "";
|
my $envVarStr = "";
|
||||||
foreach my $line (@prestartenvvars) {
|
foreach my $line (@prestartenvvars) {
|
||||||
$line = replace_OGP_Env_Vars("", $home_id, $home_path, $line, $game_key);
|
$line = replace_GSP_Env_Vars("", $home_id, $home_path, $line, $game_key);
|
||||||
if($line ne ""){
|
if($line ne ""){
|
||||||
logger "Configuring environment variable: $line";
|
logger "Configuring environment variable: $line";
|
||||||
$envVarStr .= "$line\n";
|
$envVarStr .= "$line\n";
|
||||||
|
|
@ -1694,8 +1694,8 @@ sub universal_start_without_decrypt
|
||||||
my $run_before_start;
|
my $run_before_start;
|
||||||
prepare_server_content_runtime_without_decrypt($home_path);
|
prepare_server_content_runtime_without_decrypt($home_path);
|
||||||
|
|
||||||
# Replace any OGP variables found in the command line
|
# Replace any GSP variables found in the command line
|
||||||
$startup_cmd = replace_OGP_Env_Vars($screen_id, $home_id, $home_path, $startup_cmd, $game_key);
|
$startup_cmd = replace_GSP_Env_Vars($screen_id, $home_id, $home_path, $startup_cmd, $game_key);
|
||||||
|
|
||||||
if($file_extension eq ".exe" or $file_extension eq ".bat")
|
if($file_extension eq ".exe" or $file_extension eq ".bat")
|
||||||
{
|
{
|
||||||
|
|
@ -1706,7 +1706,7 @@ sub universal_start_without_decrypt
|
||||||
$command = "taskset -c $cpu wine $server_exe $startup_cmd";
|
$command = "taskset -c $cpu wine $server_exe $startup_cmd";
|
||||||
}
|
}
|
||||||
|
|
||||||
if(preference_enabled('gsp_autorestart_server', 'ogp_autorestart_server', '1')){
|
if(preference_enabled('gsp_autorestart_server', 'gsp_autorestart_server', '1')){
|
||||||
$cli_bin = create_screen_cmd_loop($screen_id, $command, $envVars, undef, $status_hint_file);
|
$cli_bin = create_screen_cmd_loop($screen_id, $command, $envVars, undef, $status_hint_file);
|
||||||
}else{
|
}else{
|
||||||
$cli_bin = create_screen_cmd_loop($screen_id, $command, $envVars, 1);
|
$cli_bin = create_screen_cmd_loop($screen_id, $command, $envVars, 1);
|
||||||
|
|
@ -1721,7 +1721,7 @@ sub universal_start_without_decrypt
|
||||||
$command = "taskset -c $cpu $startup_cmd";
|
$command = "taskset -c $cpu $startup_cmd";
|
||||||
}
|
}
|
||||||
|
|
||||||
if(preference_enabled('gsp_autorestart_server', 'ogp_autorestart_server', '1')){
|
if(preference_enabled('gsp_autorestart_server', 'gsp_autorestart_server', '1')){
|
||||||
$cli_bin = create_screen_cmd_loop($screen_id, $command, $envVars, undef, $status_hint_file);
|
$cli_bin = create_screen_cmd_loop($screen_id, $command, $envVars, undef, $status_hint_file);
|
||||||
}else{
|
}else{
|
||||||
$cli_bin = create_screen_cmd_loop($screen_id, $command, $envVars, 1);
|
$cli_bin = create_screen_cmd_loop($screen_id, $command, $envVars, 1);
|
||||||
|
|
@ -1736,7 +1736,7 @@ sub universal_start_without_decrypt
|
||||||
$command = "taskset -c $cpu ./$server_exe $startup_cmd";
|
$command = "taskset -c $cpu ./$server_exe $startup_cmd";
|
||||||
}
|
}
|
||||||
|
|
||||||
if(preference_enabled('gsp_autorestart_server', 'ogp_autorestart_server', '1')){
|
if(preference_enabled('gsp_autorestart_server', 'gsp_autorestart_server', '1')){
|
||||||
$cli_bin = create_screen_cmd_loop($screen_id, $command, $envVars, undef, $status_hint_file);
|
$cli_bin = create_screen_cmd_loop($screen_id, $command, $envVars, undef, $status_hint_file);
|
||||||
}else{
|
}else{
|
||||||
$cli_bin = create_screen_cmd_loop($screen_id, $command, $envVars, 1);
|
$cli_bin = create_screen_cmd_loop($screen_id, $command, $envVars, 1);
|
||||||
|
|
@ -2929,7 +2929,7 @@ sub lock_additional_files_logic{
|
||||||
|
|
||||||
my $commandStr = "";
|
my $commandStr = "";
|
||||||
$filesToLock = startup_comma_format_to_multiline($filesToLock);
|
$filesToLock = startup_comma_format_to_multiline($filesToLock);
|
||||||
$filesToLock = replace_OGP_Env_Vars("", "", $homedir, $filesToLock);
|
$filesToLock = replace_GSP_Env_Vars("", "", $homedir, $filesToLock);
|
||||||
my @filesToProcess = split /[\r\n]+/, $filesToLock;
|
my @filesToProcess = split /[\r\n]+/, $filesToLock;
|
||||||
foreach my $line (@filesToProcess) {
|
foreach my $line (@filesToProcess) {
|
||||||
my $fullPath = $homedir . "/" . $line;
|
my $fullPath = $homedir . "/" . $line;
|
||||||
|
|
@ -2993,7 +2993,7 @@ sub multiline_to_startup_comma_format{
|
||||||
my ($multiLineVar) = @_;
|
my ($multiLineVar) = @_;
|
||||||
$multiLineVar =~ s/,//g; # commas are invalid anyways in bash
|
$multiLineVar =~ s/,//g; # commas are invalid anyways in bash
|
||||||
$multiLineVar =~ s/[\r]+//g;
|
$multiLineVar =~ s/[\r]+//g;
|
||||||
$multiLineVar =~ s/[\n]+/{OGPNEWLINE}/g;
|
$multiLineVar =~ s/[\n]+/{GSPNEWLINE}/g;
|
||||||
return $multiLineVar;
|
return $multiLineVar;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -3005,7 +3005,7 @@ sub multiline_to_bash_commands{
|
||||||
|
|
||||||
sub startup_comma_format_to_multiline{
|
sub startup_comma_format_to_multiline{
|
||||||
my ($multiLineVar) = @_;
|
my ($multiLineVar) = @_;
|
||||||
$multiLineVar =~ s/{OGPNEWLINE}/\n/g;
|
$multiLineVar =~ s/{GSPNEWLINE}/\n/g;
|
||||||
return $multiLineVar;
|
return $multiLineVar;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -4236,19 +4236,19 @@ sub collect_and_insert_process_samples
|
||||||
chomp($session);
|
chomp($session);
|
||||||
next unless $session;
|
next unless $session;
|
||||||
|
|
||||||
# Extract server name from screen session name (format: OGP_HOME_000001518 or similar)
|
# Extract server name from screen session name (format: GSP_HOME_000001518 or similar)
|
||||||
my $server_name = $session;
|
my $server_name = $session;
|
||||||
my $server_path = '/';
|
my $server_path = '/';
|
||||||
|
|
||||||
# Try to extract home_id from OGP screen session and map to server_id
|
# Try to extract home_id from GSP screen session and map to server_id
|
||||||
if ($session =~ /OGP_HOME_0*(\d+)/) {
|
if ($session =~ /GSP_HOME_0*(\d+)/) {
|
||||||
my $home_id = $1;
|
my $home_id = $1;
|
||||||
if (exists $home_id_to_server_id{$home_id}) {
|
if (exists $home_id_to_server_id{$home_id}) {
|
||||||
$server_name = $home_id_to_server_id{$home_id}; # Use actual server ID
|
$server_name = $home_id_to_server_id{$home_id}; # Use actual server ID
|
||||||
} else {
|
} else {
|
||||||
$server_name = "GameServer_Home_$home_id"; # Fallback to home_id
|
$server_name = "GameServer_Home_$home_id"; # Fallback to home_id
|
||||||
}
|
}
|
||||||
} elsif ($session =~ /OGP_\w+_(.+)/) {
|
} elsif ($session =~ /GSP_\w+_(.+)/) {
|
||||||
$server_name = $1;
|
$server_name = $1;
|
||||||
} elsif ($session =~ /(\d+)\.(.+)/) {
|
} elsif ($session =~ /(\d+)\.(.+)/) {
|
||||||
$server_name = $2;
|
$server_name = $2;
|
||||||
|
|
@ -4316,7 +4316,7 @@ sub collect_and_insert_process_samples
|
||||||
# Avoid duplicates by checking if we already processed this PID
|
# Avoid duplicates by checking if we already processed this PID
|
||||||
next if grep { $_->{pid} == $pid } @processes;
|
next if grep { $_->{pid} == $pid } @processes;
|
||||||
|
|
||||||
# Only process if this executable has a startup file (is managed by OGP)
|
# Only process if this executable has a startup file (is managed by GSP)
|
||||||
if (exists $startup_executables{$exe_name}) {
|
if (exists $startup_executables{$exe_name}) {
|
||||||
my $startup_info = $startup_executables{$exe_name};
|
my $startup_info = $startup_executables{$exe_name};
|
||||||
# Use the actual server ID from the startup file
|
# Use the actual server ID from the startup file
|
||||||
|
|
@ -4326,7 +4326,7 @@ sub collect_and_insert_process_samples
|
||||||
my $proc_info = get_process_info($pid, $server_name, $server_path);
|
my $proc_info = get_process_info($pid, $server_name, $server_path);
|
||||||
push @processes, $proc_info if $proc_info;
|
push @processes, $proc_info if $proc_info;
|
||||||
}
|
}
|
||||||
# If no startup file exists for this executable, we skip it (not managed by OGP)
|
# If no startup file exists for this executable, we skip it (not managed by GSP)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -4873,7 +4873,7 @@ sub ftp_mgr
|
||||||
$password =~ s/('+)/'\"$1\"'/g;
|
$password =~ s/('+)/'\"$1\"'/g;
|
||||||
$home_path =~ s/('+)/'\"$1\"'/g;
|
$home_path =~ s/('+)/'\"$1\"'/g;
|
||||||
|
|
||||||
if(preference_enabled('gsp_manages_ftp', 'ogp_manages_ftp', '1')){
|
if(preference_enabled('gsp_manages_ftp', 'gsp_manages_ftp', '1')){
|
||||||
if( defined($Cfg::Preferences{ftp_method}) && $Cfg::Preferences{ftp_method} eq "IspConfig")
|
if( defined($Cfg::Preferences{ftp_method}) && $Cfg::Preferences{ftp_method} eq "IspConfig")
|
||||||
{
|
{
|
||||||
use constant ISPCONFIG_DIR => Path::Class::Dir->new(AGENT_RUN_DIR, 'IspConfig');
|
use constant ISPCONFIG_DIR => Path::Class::Dir->new(AGENT_RUN_DIR, 'IspConfig');
|
||||||
|
|
@ -4935,7 +4935,7 @@ sub ftp_mgr
|
||||||
|
|
||||||
chmod 0777, 'ehcp_ftp_log.txt';
|
chmod 0777, 'ehcp_ftp_log.txt';
|
||||||
|
|
||||||
# In order to access the FTP files, the vsftpd user needs to be added to the ogp group
|
# In order to access the FTP files, the vsftpd user needs to be added to the GSP group
|
||||||
sudo_exec_without_decrypt("usermod -a -G '$gid' ftp");
|
sudo_exec_without_decrypt("usermod -a -G '$gid' ftp");
|
||||||
sudo_exec_without_decrypt("usermod -a -G '$gid' vsftpd");
|
sudo_exec_without_decrypt("usermod -a -G '$gid' vsftpd");
|
||||||
sudo_exec_without_decrypt("usermod -a -G '$gidTwo' ftp");
|
sudo_exec_without_decrypt("usermod -a -G '$gidTwo' ftp");
|
||||||
|
|
@ -5565,8 +5565,8 @@ if command -v rsync >/dev/null 2>&1; then
|
||||||
else
|
else
|
||||||
(cd "\$SRC" && tar --exclude='./Cfg' --exclude='./ServerFiles' --exclude='./Schedule' --exclude='./logs' --exclude='./screenlogs' --exclude='./steamcmd' --exclude='./startups' --exclude='./tmp' --exclude='./shared' --exclude='./component_backups' --exclude='./*.pid' -cf - .) | (cd "\$DEST" && tar -xf -) >> "\$LOG" 2>&1 || fail "tar copy failed"
|
(cd "\$SRC" && tar --exclude='./Cfg' --exclude='./ServerFiles' --exclude='./Schedule' --exclude='./logs' --exclude='./screenlogs' --exclude='./steamcmd' --exclude='./startups' --exclude='./tmp' --exclude='./shared' --exclude='./component_backups' --exclude='./*.pid' -cf - .) | (cd "\$DEST" && tar -xf -) >> "\$LOG" 2>&1 || fail "tar copy failed"
|
||||||
fi
|
fi
|
||||||
if [ -f "\$DEST/ogp_agent.pl" ]; then
|
if [ -f "\$DEST/gsp_agent.pl" ]; then
|
||||||
perl -c "\$DEST/ogp_agent.pl" >> "\$LOG" 2>&1 || fail "Updated ogp_agent.pl failed syntax validation"
|
perl -c "\$DEST/gsp_agent.pl" >> "\$LOG" 2>&1 || fail "Updated gsp_agent.pl failed syntax validation"
|
||||||
fi
|
fi
|
||||||
if [ -n "\$POST_UPDATE" ]; then
|
if [ -n "\$POST_UPDATE" ]; then
|
||||||
(cd "\$DEST" && bash -lc "\$POST_UPDATE") >> "\$LOG" 2>&1 || fail "post-update command failed"
|
(cd "\$DEST" && bash -lc "\$POST_UPDATE") >> "\$LOG" 2>&1 || fail "post-update command failed"
|
||||||
|
|
@ -5576,20 +5576,14 @@ sleep 2
|
||||||
if command -v systemctl >/dev/null 2>&1 && systemctl list-unit-files 2>/dev/null | grep -q '^gsp_agent\\.service'; then
|
if command -v systemctl >/dev/null 2>&1 && systemctl list-unit-files 2>/dev/null | grep -q '^gsp_agent\\.service'; then
|
||||||
systemctl restart gsp_agent.service >> "\$LOG" 2>&1 && exit 0
|
systemctl restart gsp_agent.service >> "\$LOG" 2>&1 && exit 0
|
||||||
fi
|
fi
|
||||||
if command -v systemctl >/dev/null 2>&1 && systemctl list-unit-files 2>/dev/null | grep -q '^ogp_agent\\.service'; then
|
|
||||||
systemctl restart ogp_agent.service >> "\$LOG" 2>&1 && exit 0
|
|
||||||
fi
|
|
||||||
cd "\$DEST" || exit 0
|
cd "\$DEST" || exit 0
|
||||||
if [ -f gsp_agent_run.pid ]; then kill "\$(cat gsp_agent_run.pid)" >/dev/null 2>&1 || true; fi
|
if [ -f gsp_agent_run.pid ]; then kill "\$(cat gsp_agent_run.pid)" >/dev/null 2>&1 || true; fi
|
||||||
if [ -f ogp_agent_run.pid ]; then kill "\$(cat ogp_agent_run.pid)" >/dev/null 2>&1 || true; fi
|
if [ -f gsp_agent.pid ]; then kill "\$(cat gsp_agent.pid)" >/dev/null 2>&1 || true; fi
|
||||||
if [ -f ogp_agent.pid ]; then kill "\$(cat ogp_agent.pid)" >/dev/null 2>&1 || true; fi
|
|
||||||
sleep 2
|
sleep 2
|
||||||
if [ -f gsp_agent_run ]; then
|
if [ -f gsp_agent_run ]; then
|
||||||
screen -d -m -t "gsp_agent" -c $screenrc_q -S gsp_agent bash gsp_agent_run -pidfile gsp_agent_run.pid >> "\$LOG" 2>&1 || true
|
screen -d -m -t "gsp_agent" -c $screenrc_q -S gsp_agent bash gsp_agent_run -pidfile gsp_agent_run.pid >> "\$LOG" 2>&1 || true
|
||||||
elif [ -f ogp_agent_run ]; then
|
|
||||||
screen -d -m -t "gsp_agent" -c $screenrc_q -S gsp_agent bash ogp_agent_run -pidfile gsp_agent_run.pid >> "\$LOG" 2>&1 || true
|
|
||||||
else
|
else
|
||||||
screen -d -m -t "gsp_agent" -c $screenrc_q -S gsp_agent perl ogp_agent.pl >> "\$LOG" 2>&1 || true
|
screen -d -m -t "gsp_agent" -c $screenrc_q -S gsp_agent perl gsp_agent.pl >> "\$LOG" 2>&1 || true
|
||||||
fi
|
fi
|
||||||
log "restart attempted"
|
log "restart attempted"
|
||||||
rm -rf "\$TMP"
|
rm -rf "\$TMP"
|
||||||
|
|
@ -5620,9 +5614,9 @@ sub agent_restart
|
||||||
if ($dec_check eq 'restart')
|
if ($dec_check eq 'restart')
|
||||||
{
|
{
|
||||||
chdir AGENT_RUN_DIR;
|
chdir AGENT_RUN_DIR;
|
||||||
if(-e "gsp_agent_run.pid" || -e "ogp_agent_run.pid")
|
if(-e "gsp_agent_run.pid")
|
||||||
{
|
{
|
||||||
my $run_pid_file = -e "gsp_agent_run.pid" ? "gsp_agent_run.pid" : "ogp_agent_run.pid";
|
my $run_pid_file = "gsp_agent_run.pid";
|
||||||
my $init_pid = `cat $run_pid_file`;
|
my $init_pid = `cat $run_pid_file`;
|
||||||
chomp($init_pid);
|
chomp($init_pid);
|
||||||
|
|
||||||
|
|
@ -5630,10 +5624,10 @@ sub agent_restart
|
||||||
{
|
{
|
||||||
my $or_exist = "";
|
my $or_exist = "";
|
||||||
my $rm_pid_file = "";
|
my $rm_pid_file = "";
|
||||||
if(-e "ogp_agent.pid")
|
if(-e "gsp_agent.pid")
|
||||||
{
|
{
|
||||||
$rm_pid_file = " ogp_agent.pid";
|
$rm_pid_file = " gsp_agent.pid";
|
||||||
my $agent_pid = `cat ogp_agent.pid`;
|
my $agent_pid = `cat gsp_agent.pid`;
|
||||||
chomp($agent_pid);
|
chomp($agent_pid);
|
||||||
if( kill 0, $agent_pid )
|
if( kill 0, $agent_pid )
|
||||||
{
|
{
|
||||||
|
|
@ -5645,10 +5639,10 @@ sub agent_restart
|
||||||
my $restart = "echo -n \"Stopping GSP Agent...\"\n".
|
my $restart = "echo -n \"Stopping GSP Agent...\"\n".
|
||||||
"kill $init_pid\n".
|
"kill $init_pid\n".
|
||||||
"while [ -e /proc/$init_pid $or_exist ];do echo -n .;sleep 1;done\n".
|
"while [ -e /proc/$init_pid $or_exist ];do echo -n .;sleep 1;done\n".
|
||||||
"rm -f gsp_agent_run.pid ogp_agent_run.pid $rm_pid_file\necho \" [OK]\"\n".
|
"rm -f gsp_agent_run.pid $rm_pid_file\necho \" [OK]\"\n".
|
||||||
"echo -n \"Starting GSP Agent...\"\n".
|
"echo -n \"Starting GSP Agent...\"\n".
|
||||||
"screen -d -m -t \"gsp_agent\" -c \"" . SCREENRC_FILE . "\" -S gsp_agent bash gsp_agent_run -pidfile gsp_agent_run.pid\n".
|
"screen -d -m -t \"gsp_agent\" -c \"" . SCREENRC_FILE . "\" -S gsp_agent bash gsp_agent_run -pidfile gsp_agent_run.pid\n".
|
||||||
"while [ ! -e gsp_agent_run.pid -o ! -e ogp_agent.pid ];do echo -n .;sleep 1;done\n".
|
"while [ ! -e gsp_agent_run.pid -o ! -e gsp_agent.pid ];do echo -n .;sleep 1;done\n".
|
||||||
"echo \" [OK]\"\n".
|
"echo \" [OK]\"\n".
|
||||||
"rm -f tmp_restart.sh\n".
|
"rm -f tmp_restart.sh\n".
|
||||||
"exit 0\n";
|
"exit 0\n";
|
||||||
|
|
@ -6650,8 +6644,8 @@ sub generate_post_install_scripts
|
||||||
' if [ -z "$installed_path" ] && [ -e "$mods_full_path/$mod_id" ];then installed_path="$mods_full_path/$mod_id";fi'."\n".
|
' if [ -z "$installed_path" ] && [ -e "$mods_full_path/$mod_id" ];then installed_path="$mods_full_path/$mod_id";fi'."\n".
|
||||||
' installed_folder="$(basename "$installed_path")"'."\n".
|
' installed_folder="$(basename "$installed_path")"'."\n".
|
||||||
" install_time=\"\$(date '+%Y-%m-%d %H:%M:%S')\"\n".
|
" install_time=\"\$(date '+%Y-%m-%d %H:%M:%S')\"\n".
|
||||||
' printf "%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\n" "${mod_string[$i]}" "$mod_id" "${mod_name[$i]}" "$installed_folder" "$installed_path" "$workshop_id" "installed" "$install_time" "$install_time" > "${mods_info_home_path}${mod_id}.ogpmod"'."\n".
|
' printf "%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\n" "${mod_string[$i]}" "$mod_id" "${mod_name[$i]}" "$installed_folder" "$installed_path" "$workshop_id" "installed" "$install_time" "$install_time" > "${mods_info_home_path}${mod_id}.gspmod"'."\n".
|
||||||
' printf "%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\n" "${mod_string[$i]}" "$mod_id" "${mod_name[$i]}" "$installed_folder" "$installed_path" "$workshop_id" "installed" "$install_time" "$install_time" > "${mods_info_path}${mod_string[$i]}.ogpmod"'."\n".
|
' printf "%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\n" "${mod_string[$i]}" "$mod_id" "${mod_name[$i]}" "$installed_folder" "$installed_path" "$workshop_id" "installed" "$install_time" "$install_time" > "${mods_info_path}${mod_string[$i]}.gspmod"'."\n".
|
||||||
' i=$(expr $i + 1)'."\n".
|
' i=$(expr $i + 1)'."\n".
|
||||||
'done'."\n".
|
'done'."\n".
|
||||||
'write_workshop_status completed "Workshop install completed"'."\n".
|
'write_workshop_status completed "Workshop install completed"'."\n".
|
||||||
|
|
@ -6678,7 +6672,7 @@ sub get_workshop_mods_info()
|
||||||
my @mods_info;
|
my @mods_info;
|
||||||
while(my $mod_info_file = readdir(MODS_INFO_DIR))
|
while(my $mod_info_file = readdir(MODS_INFO_DIR))
|
||||||
{
|
{
|
||||||
if($mod_info_file =~ /\.ogpmod$/)
|
if($mod_info_file =~ /\.gspmod$/)
|
||||||
{
|
{
|
||||||
my $mod_info_file_path = Path::Class::File->new($mods_info_dir_path, $mod_info_file);
|
my $mod_info_file_path = Path::Class::File->new($mods_info_dir_path, $mod_info_file);
|
||||||
if(open(my $fh, '<:encoding(UTF-8)', $mod_info_file_path))
|
if(open(my $fh, '<:encoding(UTF-8)', $mod_info_file_path))
|
||||||
|
|
@ -6687,7 +6681,7 @@ sub get_workshop_mods_info()
|
||||||
chomp $row;
|
chomp $row;
|
||||||
if($row ne "")
|
if($row ne "")
|
||||||
{
|
{
|
||||||
my ($string_name, $ext) = split(/\.ogp/, $mod_info_file);
|
my ($string_name, $ext) = split(/\.gsp/, $mod_info_file);
|
||||||
if(index($row, "\t") >= 0)
|
if(index($row, "\t") >= 0)
|
||||||
{
|
{
|
||||||
push @mods_info, $row;
|
push @mods_info, $row;
|
||||||
|
|
@ -3,7 +3,7 @@
|
||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
|
|
||||||
AGENTDIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
AGENTDIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||||
AGENT="${AGENTDIR}/ogp_agent.pl"
|
AGENT="${AGENTDIR}/gsp_agent.pl"
|
||||||
PID_FILE=""
|
PID_FILE=""
|
||||||
TIMEOUT=10
|
TIMEOUT=10
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,14 +2,14 @@
|
||||||
|
|
||||||
# Generic Init script if we can't find what kind of Linux we're on
|
# Generic Init script if we can't find what kind of Linux we're on
|
||||||
|
|
||||||
agent_dir=OGP_AGENT_DIR
|
agent_dir=GSP_AGENT_DIR
|
||||||
agent_user=OGP_USER
|
agent_user=GSP_USER
|
||||||
|
|
||||||
# Start function.
|
# Start function.
|
||||||
start() {
|
start() {
|
||||||
echo "Starting GSP Agent..."
|
echo "Starting GSP Agent..."
|
||||||
cd $agent_dir
|
cd $agent_dir
|
||||||
su -c "screen -d -m -t gsp_agent -c ogp_screenrc -S gsp_agent ./gsp_agent_run -pidfile gsp_agent_run.pid" $agent_user &> $agent_dir/gsp_agent.svc &
|
su -c "screen -d -m -t gsp_agent -c gsp_screenrc -S gsp_agent ./gsp_agent_run -pidfile gsp_agent_run.pid" $agent_user &> $agent_dir/gsp_agent.svc &
|
||||||
echo
|
echo
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
#
|
#
|
||||||
### BEGIN INIT INFO
|
### BEGIN INIT INFO
|
||||||
# Provides: ogp_agent
|
# Provides: gsp_agent
|
||||||
# Required-Start: $all
|
# Required-Start: $all
|
||||||
# Required-Stop: $all
|
# Required-Stop: $all
|
||||||
# Should-Start: $all
|
# Should-Start: $all
|
||||||
|
|
@ -13,8 +13,8 @@
|
||||||
### END INIT INFO
|
### END INIT INFO
|
||||||
#
|
#
|
||||||
|
|
||||||
agent_dir=OGP_AGENT_DIR
|
agent_dir=GSP_AGENT_DIR
|
||||||
agent_user=OGP_USER
|
agent_user=GSP_USER
|
||||||
|
|
||||||
#
|
#
|
||||||
# main()
|
# main()
|
||||||
|
|
@ -90,7 +90,7 @@ start() {
|
||||||
fi
|
fi
|
||||||
|
|
||||||
cd $agent_dir
|
cd $agent_dir
|
||||||
out=$(su -c "screen -d -m -t gsp_agent -c ogp_screenrc -S gsp_agent ./gsp_agent_run -pidfile gsp_agent_run.pid" $agent_user >/dev/null 2>&1)
|
out=$(su -c "screen -d -m -t gsp_agent -c gsp_screenrc -S gsp_agent ./gsp_agent_run -pidfile gsp_agent_run.pid" $agent_user >/dev/null 2>&1)
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -4,8 +4,8 @@
|
||||||
|
|
||||||
# GF: Config is in $agent_dir/Cfg/Config.pm
|
# GF: Config is in $agent_dir/Cfg/Config.pm
|
||||||
|
|
||||||
agent_dir=OGP_AGENT_DIR
|
agent_dir=GSP_AGENT_DIR
|
||||||
agent_user=OGP_USER
|
agent_user=GSP_USER
|
||||||
|
|
||||||
depend() {
|
depend() {
|
||||||
need net
|
need net
|
||||||
|
|
@ -13,7 +13,7 @@ depend() {
|
||||||
|
|
||||||
start() {
|
start() {
|
||||||
ebegin "Starting GSP Agent"
|
ebegin "Starting GSP Agent"
|
||||||
start-stop-daemon --verbose --chdir $agent_dir --start --background --user $agent_user -e PWD="$agent_dir" --exec screen -d -m -t gsp_agent -c ogp_screenrc -S gsp_agent ./gsp_agent_run -pidfile gsp_agent_run.pid
|
start-stop-daemon --verbose --chdir $agent_dir --start --background --user $agent_user -e PWD="$agent_dir" --exec screen -d -m -t gsp_agent -c gsp_screenrc -S gsp_agent ./gsp_agent_run -pidfile gsp_agent_run.pid
|
||||||
eend $? "Failed to start GSP Agent"
|
eend $? "Failed to start GSP Agent"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -8,8 +8,8 @@
|
||||||
# chkconfig: 2345 88 10
|
# chkconfig: 2345 88 10
|
||||||
# description: Startup/shutdown script for the GSP Agent
|
# description: Startup/shutdown script for the GSP Agent
|
||||||
|
|
||||||
agent_dir=OGP_AGENT_DIR
|
agent_dir=GSP_AGENT_DIR
|
||||||
agent_user=OGP_USER
|
agent_user=GSP_USER
|
||||||
service=gsp_agent
|
service=gsp_agent
|
||||||
|
|
||||||
# Source function library.
|
# Source function library.
|
||||||
|
|
@ -100,7 +100,7 @@ start() {
|
||||||
fi
|
fi
|
||||||
|
|
||||||
cd $agent_dir
|
cd $agent_dir
|
||||||
su -c "screen -d -m -t gsp_agent -c ogp_screenrc -S gsp_agent ./gsp_agent_run -pidfile gsp_agent_run.pid" $agent_user &> $agent_dir/gsp_agent.svc &
|
su -c "screen -d -m -t gsp_agent -c gsp_screenrc -S gsp_agent ./gsp_agent_run -pidfile gsp_agent_run.pid" $agent_user &> $agent_dir/gsp_agent.svc &
|
||||||
echo -n "started successfully."
|
echo -n "started successfully."
|
||||||
bold=`tput bold`
|
bold=`tput bold`
|
||||||
normal=`tput sgr0`
|
normal=`tput sgr0`
|
||||||
|
|
@ -167,7 +167,7 @@ mkdir -p \
|
||||||
|
|
||||||
touch "${INSTALL_DIR}/_gsp_content/runtime/server_content.pids"
|
touch "${INSTALL_DIR}/_gsp_content/runtime/server_content.pids"
|
||||||
|
|
||||||
chmod +x "${INSTALL_DIR}/gsp_agent_run" "${INSTALL_DIR}/ogp_agent_run" "${INSTALL_DIR}/agent_conf.sh" "${INSTALL_DIR}/install_agent_prereqs.sh" 2>/dev/null || true
|
chmod +x "${INSTALL_DIR}/gsp_agent_run" "${INSTALL_DIR}/agent_conf.sh" "${INSTALL_DIR}/install_agent_prereqs.sh" 2>/dev/null || true
|
||||||
chown -R "${AGENT_USER}:${AGENT_USER}" "$INSTALL_DIR"
|
chown -R "${AGENT_USER}:${AGENT_USER}" "$INSTALL_DIR"
|
||||||
|
|
||||||
echo
|
echo
|
||||||
|
|
|
||||||
|
|
@ -1,5 +0,0 @@
|
||||||
#!/usr/bin/env bash
|
|
||||||
|
|
||||||
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
||||||
echo "ogp_agent_run is a legacy compatibility wrapper. Use gsp_agent_run for new GSP installs." >&2
|
|
||||||
exec "${SCRIPT_DIR}/gsp_agent_run" "$@"
|
|
||||||
|
|
@ -1 +1 @@
|
||||||
1518,/home/gameserver/1518,srcds_run,,-game cstrike -pidfile ../ogp_game_startup.pid +map cs_assault +ip 173.208.236.122 -port 5400 +maxplayers 64 -condebug -nohltv -tickrate "64",5400,173.208.236.122,NA,0,,,css_linux32,console.loggameserver@gs-kansascity-01
|
1518,/home/gameserver/1518,srcds_run,,-game cstrike -pidfile ../gsp_game_startup.pid +map cs_assault +ip 173.208.236.122 -port 5400 +maxplayers 64 -condebug -nohltv -tickrate "64",5400,173.208.236.122,NA,0,,,css_linux32,console.loggameserver@gs-kansascity-01
|
||||||
|
|
@ -1,18 +0,0 @@
|
||||||
# Legacy compatibility unit. New installs should use gsp_agent.service.
|
|
||||||
|
|
||||||
[Unit]
|
|
||||||
Description=GameServer Panel Linux Agent legacy service alias
|
|
||||||
After=network-online.target
|
|
||||||
Wants=network-online.target
|
|
||||||
|
|
||||||
[Service]
|
|
||||||
Type=simple
|
|
||||||
User={GSP_AGENT_USER}
|
|
||||||
Group={GSP_AGENT_USER}
|
|
||||||
WorkingDirectory={GSP_AGENT_PATH}
|
|
||||||
ExecStart={GSP_AGENT_PATH}/gsp_agent_run -pidfile {GSP_AGENT_PATH}/gsp_agent_run.pid
|
|
||||||
Restart=on-failure
|
|
||||||
RestartSec=10
|
|
||||||
|
|
||||||
[Install]
|
|
||||||
WantedBy=multi-user.target
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue