Advertisement
madcatzano

Untitled

Aug 29th, 2015
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.75 KB | None | 0 0
  1. _start.sh
  2.  
  3. #!/bin/bash
  4.  
  5. if [ -z "$1" ] || [ -z "$2" ] || [ -z "$3" ] || [ -z "$4" ]; then
  6. echo "Hasznalat: $0 name port max_players rcon" ;
  7. else
  8. screen -dmS $1 /home/dedicated/cs2d_dedicated -max-players $2 -port $3 -rcon $4
  9. echo "started: $1"
  10. fi
  11.  
  12. ======
  13.  
  14. chmod +x _start.sh
  15.  
  16. test.php:
  17.  
  18. <?php
  19. $srv = Array(
  20. "path" => "/var/www/_start.sh",
  21. "name" => "test2",
  22. "port" => "808080",
  23. "maxplayers" => "32",
  24. "rcon" => "rconpass",
  25. );
  26. //Array feldolgozรกsa ide a fenti helyett...
  27.  
  28. sendAction($srv["path"], $srv["name"], $srv["port"], $srv["maxplayers"], $srv["rcon"]);
  29.  
  30. function sendAction($path, $name, $port, $maxplayers, $rcon) {
  31. passthru($path." ".$name." ".$port." ".$maxplayers." ".$rcon." 2>&1");
  32. }
  33. ?>
  34.  
  35. http://localhost/test.php
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement