xunin 0 Report post Posted September 10, 2015 hey, i have setup my exile mod server and wanted to ask if someone can share a stat/stop/restart and global message(every x minutes spam) script for linuxall tools that i´ve found are designed for windows Share this post Link to post Share on other sites
TheJoker 0 Report post Posted September 10, 2015 Dont know but i think BEC is working with linux ?Here is the Link: http://www.ibattle.org/downloads/ Share this post Link to post Share on other sites
Flowrider85 10 Report post Posted September 10, 2015 (edited) Requirement(s) OA/CO or Arma3 Dedicated server running on Windows. Edited September 10, 2015 by Flowrider85 Share this post Link to post Share on other sites
TheJoker 0 Report post Posted September 10, 2015 (edited) but found this too ..Also, if youre trying to run Bec under Linux/Wine you MUST use the --dsc startup option. Edited September 10, 2015 by TheJoker Share this post Link to post Share on other sites
second_coming 836 Report post Posted September 10, 2015 (edited) Based on the code I found here:https://raw.githubusercontent.com/katzsmile/DayZAdmin/master/modules/rcon.phpCreate a file config.php<?php $serverip = "127.0.0.1"; $serverport = "2302"; $rconpassword = "xxxx"; ?>create rcon.php<?php function strToHex($string) { $hex=''; for ($i=0; $i < strlen($string); $i++) { $hex .= dechex(ord($string[$i])); } return $hex; } function hexToStr($hex) { $string=''; for ($i=0; $i < strlen($hex)-1; $i+=2) { $string .= chr(hexdec($hex[$i].$hex[$i+1])); } return $string; } function computeUnsignedCRC32($str){ sscanf(crc32($str), "%u", $var); $var = dechex($var + 0); return $var; } function dec_to_hex($dec) { $sign = ""; // suppress errors $h = null; if( $dec < 0){ $sign = "-"; $dec = abs($dec); } $hex = Array( 0 => 0, 1 => 1, 2 => 2, 3 => 3, 4 => 4, 5 => 5, 6 => 6, 7 => 7, 8 => 8, 9 => 9, 10 => 'a', 11 => 'b', 12 => 'c', 13 => 'd', 14 => 'e', 15 => 'f' ); do { $h = $hex[($dec%16)] . $h; $dec /= 16; } while( $dec >= 1 ); return $sign . $h; } function get_checksum($cs) { $var = computeUnsignedCRC32($cs); //echo "crchex: ".$var."<br/>"; $x = ('0x'); $a = substr($var, 0, 2); $a = $x.$a; $b = substr($var, 2, 2); $b = $x.$b; $c = substr($var, 4, 2); $c = $x.$c; $d = substr($var, 6, 2); $d = $x.$d; return chr($d).chr($c).chr($b).chr($a); } function rcon($serverip,$serverport,$rconpassword,$cmd){ $passhead = chr(0xFF).chr(0x00); $head = chr(0x42).chr(0x45); $pass = $passhead.$rconpassword; $answer = ""; $checksum = get_checksum($pass); $loginmsg = $head.$checksum.$pass; $rcon = fsockopen("udp://".$serverip, $serverport, $errno, $errstr, 1); stream_set_timeout($rcon, 1); if (!$rcon) { echo "ERROR: $errno - $errstr<br />\n"; } else { fwrite($rcon, $loginmsg); $res = fread($rcon, 16); $cmdhead = chr(0xFF).chr(0x01).chr(0x00); //$cmd = "Players"; $cmd = $cmdhead.$cmd; $checksum = get_checksum($cmd); $cmdmsg = $head.$checksum.$cmd; $hlen = strlen($head.$checksum.chr(0xFF).chr(0x01)); fwrite($rcon, $cmdmsg); $answer = fread($rcon, 102400); if ( strToHex(substr($answer, 9, 1)) == "0"){ $count = strToHex(substr($answer, 10, 1)); //echo $count."<br/>"; for ($i = 0; $i < $count-1; $i++){ $answer .= fread($rcon, 102400); } } //echo strToHex(substr($answer, 0, 16))."<br/>"; //echo strToHex($answer)."<br/>"; //echo $answer."<br/>"; $cmd = "Exit"; $cmd = $cmdhead.$cmd; $checksum = get_checksum($cmd); $cmdmsg = $head.$checksum.$cmd; fwrite($rcon, $cmdmsg); } return $answer; } ?>create warning.php<?php include("rcon.php"); include("config.php"); $msg = $argv[1]; $cmd = "say -1 $msg"; rcon($serverip,$serverport,$rconpassword,$cmd); ?>You can call these from a crontab:30 1,3,5,7,9,11,13,15,17,19,21,23 * * * php -q /home/exile/arma3/restarter/warning.php "RESTART WARNING Server restarting in 30 minutes" 50 1,3,5,7,9,11,13,15,17,19,21,23 * * * php -q /home/exile/arma3/restarter/warning.php "RESTART WARNING Server restarting in 10 minutes" 55 1,3,5,7,9,11,13,15,17,19,21,23 * * * php -q /home/exile/arma3/restarter/warning.php "RESTART WARNING Server restarting in 5 minutes" 58 1,3,5,7,9,11,13,15,17,19,21,23 * * * php -q /home/exile/arma3/restarter/warning.php "RESTART WARNING Server restarting in 2 minutes" 59 1,3,5,7,9,11,13,15,17,19,21,23 * * * php -q /home/exile/arma3/restarter/warning.php "RESTART WARNING Server restarting in 1 minute" 0 0,2,4,6,8,10,12,14,16,18,20,22 * * * ./home/exile/exile_linux_startscript.sh restart Edited September 10, 2015 by second_coming 3 Share this post Link to post Share on other sites
xunin 0 Report post Posted September 10, 2015 @second_coming could you give me a short explanation on how to create those specific crontabs? I have never worked with cron before Share this post Link to post Share on other sites
second_coming 836 Report post Posted September 10, 2015 Essentially the example above is for a 2 hour restart with warnings at 30,10,5,2,1 minutes then on the deadline the restart script is triggeredhave a read of this https://en.wikipedia.org/wiki/Cron to explain how to format them correctly.Once you get your head around crontabs you will wish it was as simple with Windows Share this post Link to post Share on other sites
Drachentod 0 Report post Posted September 10, 2015 @second_comingcan you pls post your exile_linux_startscript.sh Share this post Link to post Share on other sites
Torndeco 233 Report post Posted September 10, 2015 Another alternative to using wine or phphttps://github.com/Torndeco/extDB2/releases/download/63/extDB2-v63.rarGo to Test/LinuxRun the extDB2-rcon application in a console Share this post Link to post Share on other sites
WD-40 25 Report post Posted September 10, 2015 (edited) to enter crontab edit mode use crontab -eI use this as restart start scripthttps://github.com/dgibbs64/linuxgsm Is there any option to change Rcon's "say -1" color? Edited September 10, 2015 by WD-40 Share this post Link to post Share on other sites