So after finally updating our servers to the new 0.7.2 with working restartserver command, I've noticed that the cpgs_server_ctl also needed updating. At the moment it fails to start servers which causes the cpgs_chk and gameserv_restart.sh scripts to fail.
I've patched this myself, so if anyone else is having issues with this here's a temporary fix (/var/cpanel/cpgs/cpgs_server_ctl):
(There's also a small typo in this script: )Code:#!/usr/bin/perl # # /path/to/this_script action user game install# # ex: /var/cpanel/cpgs/cpgs_server_ctl start fragger hl2 2 use IPC::Open2; use Storable qw(store retrieve nfreeze thaw dclone); my $os=lc(`uname -s`); $os =~ s/(\r|\n)//g; my $act = $ARGV[0]; my $user = $ARGV[1]; my $game = $ARGV[2]; my $srvn = $ARGV[3]; my $restart = $ARGV[4]; if((!$act) || (!$user) || (!$game)) { msglog("Missing a required argument. action($act) user($user) game($game) srvn($srvn)"); exit(0); } if($srvn !~ /^\d+$/) { msglog("Missing a required argument. action($act) user($user) game($game) srvn($srvn)"); exit(0); } my @PW = getpwnam($user); if(!@PW[0]) { msglog("Could not find user \"$user\", aborting."); exit(0); } if($act eq 'stop') { &stopsrv; } elsif($act eq 'start') { &startsrv; } elsif($act eq 'restart') { &stopsrv; sleep(2); &startsrv; } else { msglog("Unknown action: $act (stop|start|restart)"); } exit(0); ############################################################################### ######[ subroutines ]########################################################## ############################################################################### sub stopsrv { $start_args{'cpgs_user'} = $user; $start_args{'cpgs_game'} = $game; $start_args{'cpgs_srvn'} = $srvn; $start_args{'verbose'}=0; my $ser = nfreeze \%start_args; my @rp = sendssl("127.0.0.1 stopserver " . encode_base64($ser)); msglog("@rp"); } sub startsrv { my @rp1 = sendssl("127.0.0.1 singleisrunning $user $game $srvn"); my $reply; foreach my $ln(@rp1) { $reply .= $ln; } if($reply =~ /^OK:\s+(.*)/) { if("$1" eq "Down") { $start_args{'cpgs_user'} = $user; $start_args{'cpgs_game'} = $game; $start_args{'cpgs_srvn'} = $srvn; $start_args{'verbose'}=0; $start_args{'restart'} = $restart; my $ser = nfreeze \%start_args; my @rp2 = sendssl("127.0.0.1 startserver " . encode_base64($ser)); msglog("@rp2"); } # else { ignore }; } else { msglog("Could not connect to cPGSD on 127.0.0.1 to check running statis for $user $game $srvn"); } } sub sendssl { my $arg="@_"; my $ret; my @reply; my $pid = open2(\*SSLREAD,\*SSLWRITE,"/var/cpanel/cpgs/cpgs_comm",$arg); close(SSLWRITE); while(<SSLREAD>) { push(@reply,"$_"); } close(SSLREAD); return(@reply); } sub encode_base64 ($) { my $res = ""; my $eol = "\n"; pos($_[0]) = 0; while ($_[0] =~ /(.{1,45})/gs) { $res .= substr(pack("u", $1), 1); chop($res); } $res =~ tr/` -_/AA-Za-z0-9+\//; my $padding = (3 - length($_[0]) % 3) % 3; $res =~ s/.{$padding}$/"=" x $padding/e if $padding; if (length $eol) { $res =~ s/(.{1,76})/$1$eol/g; } return $res; } sub msglog { my($msg)=@_; my $time=time; my $localtime=localtime($time); print "\[$localtime\] ($0) " . $msg . "\n"; }
And while having the CPGS daemon down for a short period where I was rotating the cpgsd.log files (which would be a nice feature idea by the wayCode:msglog("Could not connect to cPGSD on 127.0.0.1 to check running statis for $user $game $srvn");), I also noticed a problem with the cpgs_cron.pl script:
This is obviously the path for the cpgsd on the WHM/cPanel server, but not for the remote servers.Code:# if we get this far, we didn't find cPGSD running already $ret = system("/usr/local/cpanel/libexec/cpgsd.pl 2>\&1 >/dev/null");



LinkBack URL
About LinkBacks
), I also noticed a problem with the cpgs_cron.pl script:
Reply With Quote
so I'll try to get the updateself routine to move it over as well to avoid the discrepancy.





