jahangir13 Posted April 21, 2014 Report Share Posted April 21, 2014 @Devd: how does that work. How can I determine the time in the game. Would be great to know that. If I restart the server with restarter.pl in between 2 planned restarts the time showing in the debug monitor is obviously wrong. If the load on the server is heavy and a second is not a second anymore the time is also wrong. Don't want to have the situation where the debug monitor says: restart in 2 minutes and in that moment it already restarts cause the cron job is accurate. Link to comment Share on other sites More sharing options...
devd Posted April 22, 2014 Report Share Posted April 22, 2014 I hope what the server has a internal timer (that ticks between sync on restart). Link to comment Share on other sites More sharing options...
jahangir13 Posted April 26, 2014 Report Share Posted April 26, 2014 I sometimes have the problem that I have a lot of PHP processes in 'ps aux' because server was not started when cron executed the restart scripts (e.g. if I shutdown the server for changes or something). I check now in my files if the pid is existent under which the server is running (e.g. 2302.pid file in the server dir), if not I exit the scripts. I've added an additional entry in the 'config.php' for the pid file and the code below the variables: <?php define("address","localhost"); // server address define("port","2302"); // server port define("password","*****"); // battleye password define("pidfilename","/home/dayzepoch/server1042/2302.pid"); // pid file of server (in server directory. e.g. 2302.pid) // check if pid file exists $filename = pidfilename; $pid = file_get_contents($filename); if ( $pid == "" ) $pid = "0"; $isrunning = false; $isrunning = posix_getpgid(intval($pid)); if ( $isrunning ) { echo "Server running. Go on...\n"; } else { echo "Server not started? Exit.\n"; exit(0); } ?> This prevents executing the say command if server is stopped. EDIT: Hm, I am still getting the Sleeping processes in ps...but however, it was maybe a good idea to stop the execution if the server is not running ;) Link to comment Share on other sites More sharing options...
Panadur Posted May 22, 2014 Report Share Posted May 22, 2014 You can also use Big Brother Bot for rcon on Linux. It is written in python and it is not a big deal to get it running on linux. There are also a few plugins for use with Arma2 and also a Banlistplugin that can be used ingame. The banlistplugin can be also used for whitelisting (not sure if you have to modify the plugin for that function). http://www.google.de/url?sa=t&rct=j&q=&esrc=s&source=web&cd=1&cad=rja&uact=8&ved=0CDAQFjAA&url=http%3A%2F%2Fwww.bigbrotherbot.net%2F&ei=bLZ9U7mAFMOuygOFk4DwAg&usg=AFQjCNGzjw3AkPjCG3D7GVCsooGrSFKjow&bvm=bv.67229260,d.bGQ Link to comment Share on other sites More sharing options...
Dew Posted May 22, 2014 Report Share Posted May 22, 2014 works like a charm .. thank you! Link to comment Share on other sites More sharing options...
jahangir13 Posted May 22, 2014 Report Share Posted May 22, 2014 Hi Dew, I've installed B3 and it's running. However I am not quite sure what to use it for ;) I mean, what can it do what I cannot do with the php scripts in this post and cron to restart? If I want to use it with epoch...I guess it's needed to download and install the Arma2 plugins additionally? Do these plugins support auto-restart and things like that? Link to comment Share on other sites More sharing options...
Dew Posted May 23, 2014 Report Share Posted May 23, 2014 ... here are my working crontabs #arma server restart 0 */3 * * * /home/dayz/arma2arrowhead/restarter.pl #restart messages 30 2,5,8,11,14,17,20,23 * * * php -q /home/dayz/restart/30min.php > /dev/null 2>&1 45 2,5,8,11,14,17,20,23 * * * php -q /home/dayz/restart/15min.php > /dev/null 2>&1 50 2,5,8,11,14,17,20,23 * * * php -q /home/dayz/restart/10min.php > /dev/null 2>&1 55 2,5,8,11,14,17,20,23 * * * php -q /home/dayz/restart/5min.php > /dev/null 2>&1 56 2,5,8,11,14,17,20,23 * * * php -q /home/dayz/restart/4min.php > /dev/null 2>&1 57 2,5,8,11,14,17,20,23 * * * php -q /home/dayz/restart/3min.php > /dev/null 2>&1 58 2,5,8,11,14,17,20,23 * * * php -q /home/dayz/restart/2min.php > /dev/null 2>&1 59 2,5,8,11,14,17,20,23 * * * php -q /home/dayz/restart/1min.php > /dev/null 2>&1 regards :-) Link to comment Share on other sites More sharing options...
Panadur Posted May 23, 2014 Report Share Posted May 23, 2014 With B3 you can replace BEC. It provides you messages, ingame commands for admins, a user database. There are also arma series plugins There are 3 plugins specifically for arma/battleye servers: arma2restarts - restarts the server with warnings before doing so and optionally renames all log files. arma2lobbykick - kicks players who stay in the lobby for too long arma2admin - can update the battleye script files while the server is running and perform mission restarts, changes etc They can be found at [email protected]:82ndab-Bravo17/b3-arma2plugins.git I didn't test them yet, and it is possible that they need a modification for use with Epoch linux. But as soon as i'm done with the whitelist plugin i'm working at, i will check also those plugins Link to comment Share on other sites More sharing options...
jahangir13 Posted May 23, 2014 Report Share Posted May 23, 2014 Ah ok, I see. Thanks!! Link to comment Share on other sites More sharing options...
meanbeandk Posted July 8, 2014 Report Share Posted July 8, 2014 Hi If i run the command php -q /home/dayz/restart/30min.php i get Got Socket! Attempting Login then nothing, please help me ;-) Link to comment Share on other sites More sharing options...
DeanReid Posted July 9, 2014 Report Share Posted July 9, 2014 Did you set the config.php with your servers rcon info? Link to comment Share on other sites More sharing options...
meanbeandk Posted July 9, 2014 Report Share Posted July 9, 2014 yes i have set config.php with my local ip, port and the pass (same as is in extension/battleye/beserver file) :-) its the same if i change my pass in config.php :huh: Got Socket! Attempting Login Then nothing. Link to comment Share on other sites More sharing options...
meanbeandk Posted July 9, 2014 Report Share Posted July 9, 2014 Reinstalld Bateleye now it works :) :D Link to comment Share on other sites More sharing options...
DeanReid Posted July 10, 2014 Report Share Posted July 10, 2014 Make sure php-cgi is installed and added to mod list Link to comment Share on other sites More sharing options...
kano5003 Posted July 29, 2014 Report Share Posted July 29, 2014 Im having abit of problems with my Crontab. These are my settings - */7 * * * * /apps/dayz/restarter.pl 30 3,7,11,15,19,14 * * * php -q /apps/dayz/Restart/30min.php 45 3,7,11,15,19,14 * * * php -q /apps/dayz/Restart/15min.php 50 3,7,11,15,19,14 * * * php -q /apps/dayz/Restart/10min.php 55 3,7,11,15,19,14 * * * php -q /apps/dayz/Restart/5min.php 56 3,7,11,15,19,14 * * * php -q /apps/dayz/Restart/4min.php 57 3,7,11,15,19,14 * * * php -q /apps/dayz/Restart/3min.php 58 3,7,11,15,19,14 * * * php -q /apps/dayz/Restart/2min.php 59 3,7,11,15,19,14 * * * php -q /apps/dayz/Restart/1min.php My directories are all correct. I have battleye set to enabled (1) in server.cfg and I have setup my config.php to the following - <?php define("address","54.79.89.46"); // server address define("port","2302"); // server port define("password","xxxx"); // battleye password ?> If it helps I type this "php -q /apps/dayz/Restart/30min.php" (without the quotes) into SSH/Server and I dont receive any messages in game. Any help would be much appreciated and will definitely consider donating. Thanks P.S - I have my restart at 7 minutes due to testing. KaNo5003. Link to comment Share on other sites More sharing options...
Albertus Smythe Posted August 4, 2014 Report Share Posted August 4, 2014 Hi If i run the command php -q /home/dayz/restart/30min.php i get Got Socket! Attempting Login then nothing, please help me ;-) I've got the same problem, Ive tracked down that the problem isn't logging on, it's this call never returning; socket_recvfrom($sock, $buf, 64, 0, $ip, $port); DeanReid could you elaborate about php-cgi, "apt-get install php-cgi" returns no such package OK it's php5-cgi, but how do I add it to the mods list (ubuntu 14.04 server) Link to comment Share on other sites More sharing options...
DeanReid Posted August 5, 2014 Report Share Posted August 5, 2014 Try this, this should work sudo apt-get install php5-cgi sudo a2enmod php5-cgi sudo service apache2 restart Link to comment Share on other sites More sharing options...
Albertus Smythe Posted August 5, 2014 Report Share Posted August 5, 2014 Try this, this should work sudo apt-get install php5-cgi Works sudo a2enmod php5-cgi ERROR: Module php5-cgi does not exist! Still no joy :( Link to comment Share on other sites More sharing options...
DeanReid Posted August 6, 2014 Report Share Posted August 6, 2014 try sudo apt-get update sudo apt-get upgrade sudo apt-get remove php5-cgi sudo apt-get install php5-cgi sudo apt-get install -f Link to comment Share on other sites More sharing options...
itzaname Posted August 8, 2014 Report Share Posted August 8, 2014 ok heres my Cronjobs 30 3,7,11,15,19,23 * * * php -q /home/dayz/Restart/30min.php 45 3,7,11,15,19,23 * * * php -q /home/dayz/Restart/15min.php 50 3,7,11,15,19,23 * * * php -q /home/dayz/Restart/10min.php 55 3,7,11,15,19,23 * * * php -q /home/dayz/Restart/5min.php 56 3,7,11,15,19,23 * * * php -q /home/dayz/Restart/4min.php 57 3,7,11,15,19,23 * * * php -q /home/dayz/Restart/3min.php 58 3,7,11,15,19,23 * * * php -q /home/dayz/Restart/2min.php 59 3,7,11,15,19,23 * * * php -q /home/dayz/Restart/1min.php Download link http://188.165.219.207/Restart.tar.gz simple as edit config.php setup the cronjobs and u have 30 min warnings on restarts Anyone have these files anymore? Link to comment Share on other sites More sharing options...
L3G0 Posted August 8, 2014 Report Share Posted August 8, 2014 I personaly restart my Windows Testserver using callExtension, which calls a shared libary that executes "ExitProcess(0);" This is a bad behavior of shared libary, but works pretty good with Arma. The Question is, if the current Linux Version can use callExtension. If this is not supported, i would recommend an additional command, lets say "876" to the writer.pl that reads the pid file and kills the process. sub h_killServer { my $childPid = shift; // maybe read the pid file at this position print "killing $childPid\n"; if ( ! (waitpid($childPid, WNOHANG)) ) { print "killing $childPid...\n"; kill 9, $childPid; die "[$$]: exiting\n"; } } Then you just need to replace "terminator" callExtension "terminate"; by diag_log format["CHILD:876"]; My Script: private ["_warntimes","_warntime","_text"]; _restartEvery = 4; // hours _warnTimes = [235, 230, 60, 30, 15, 10, 5, 3, 2, 1]; // minutes if (!isServer) exitWith {}; diag_log(format ["DEBUG RESTART MESSAGE || Inizializing || Servertime: %1 || Missiontime: %2", servertime, time]); _restartEvery = _restartEvery * 60; // convert to minutes { _warntime = (_restartEvery - _x) * 60; // get time without remaining time until restart and convert to seconds waituntil {time > _warntime}; // print warning with remaining _x minutes diag_log(format ["DEBUG RESTART MESSAGE || Missiontime: %1 || Restart in %2", time, _x]); _text = format ["SERVER RESTART IN %1 MINUTES", _x]; [nil,nil,rTitleText,_text, "PLAIN",10] call RE; } forEach _warntimes; // last warning 30 seconds before restart waituntil {time > (_restartEvery*60-30)}; diag_log(format ["DEBUG RESTART MESSAGE || Servertime: %1 || Missiontime: %2 || near Restart", servertime, time]); _text = format ["Logout NOW!", _x]; [nil,nil,rTitleText,_text, "PLAIN",10] call RE; // exit the ArmA Server when the time has come waituntil {time > _restartEvery}; "terminator" callExtension "terminate"; // should never reach this point _text = format ["meh... Restart Failed Oo", _x]; [nil,nil,rTitleText,_text, "PLAIN",10] call RE; Windows DLL for mingw #include <windows.h> #ifdef __cplusplus extern "C" { #endif __declspec (dllexport) void __stdcall _RVExtension(char *output, int outputSize, const char *function); #ifdef __cplusplus } #endif void __stdcall _RVExtension(char *output, int outputSize, const char *function) { if (strcmp(function, "terminate") == 0) { ExitProcess(0); } else { strncpy(output, function, outputSize); } } Link to comment Share on other sites More sharing options...
DeanReid Posted August 11, 2014 Report Share Posted August 11, 2014 Anyone have these files anymore? I have uploaded them to my git hub.for further usage :) I don't take any credit. https://github.com/deannreid/BattlEye-RCON-Control-PHP/ Link to comment Share on other sites More sharing options...
AlbertusSmythe Posted August 12, 2014 Report Share Posted August 12, 2014 I've got the same problem, Ive tracked down that the problem isn't logging on, it's this call never returning; socket_recvfrom($sock, $buf, 64, 0, $ip, $port); DeanReid could you elaborate about php-cgi, "apt-get install php-cgi" returns no such package OK it's php5-cgi, but how do I add it to the mods list (ubuntu 14.04 server) Just casting my programmers eyes over the code again.... where is $buf declared? the socket_recvfrom() call is the first instance of $buf in every one of the files. Just curious as $sock, $ip and $port are declared earlier in the code and for me at least this is the call that never returns. Link to comment Share on other sites More sharing options...
DeanReid Posted August 12, 2014 Report Share Posted August 12, 2014 Try using the files on my github, they are a copy from my server I have a feeling something broke somewhere, if mine dont work then its probably php, make a info.php in your web dir and then copy this in <?php phpinfo(); ?> It should look like this or this.. and this. Just search CGI and it should find it, if not then its not installed/mounted correctly, make sure you restart apache, forgot to mention this Link to comment Share on other sites More sharing options...
*OCB* Trollspace Posted August 27, 2014 Report Share Posted August 27, 2014 Scripts executed from cron live in a very different environment than the ones you run in a shell. In particular, the value of $PATH and the default directory may be different from what you think. It is usually a good idea to specify full paths to binaries in cron, e.g. "/usr/bin/php5" instead of just "php" Also, the RCON implementation here is probably broken. I will get around to write a better one some day soon. Just casting my programmers eyes over the code again.... where is $buf declared? the socket_recvfrom() call is the first instance of $buf in every one of the files. Just curious as $sock, $ip and $port are declared earlier in the code and for me at least this is the call that never returns. The call never returns because it blocks - it waits for input from the server. The connection code is broken and doesn't detect an error (and because this is UDP, the error might not be even detectable). Double check that the values in config.php - and especially the port - are correct. Link to comment Share on other sites More sharing options...
Recommended Posts
Please sign in to comment
You will be able to leave a comment after signing in
Sign In Now