overvolts 0 Posted August 22, 2014 I have a hosted VPS server with Ubuntu 14.04 operating system. I have successfully installed steamcmd and Arma 3 server following an online guide. I have also installed a apache2, php, mysql web server software. I have created a bash shell script file that starts, stops, restarts, checks status of the Arma 3 server. The problem I am having is implementing a website to be able for php to run this bash script. I have checked and the shell_exec() function is working in an attempt to run the file but I get the following errors. When running stop is says "No screen session found" and when I try to start or restart I get "Must be connected to a terminal". I'm not sure if its my autostart script or a linux operating system configuration problem. I am fairly new to linux and decided on this platform since I code websites in php that mostly run on linux based web servers. Script that works in terminal but gives errors with php execution. (a3server.sh) #!/bin/bash case "$1" in start) # Configs directory ConfigDir="/ssd/arma3/configs" # Network settings used in -cfg param networkConfig="$ConfigDir/basic.cfg" # Server configuration settings used in -config param serverConfig="$ConfigDir/server.cfg" # Server profile and difficulty settings used in -name param profileName="server" # Server-side mods mods="" # Start server screen -S ARMA /ssd/arma3/arma3server -cfg="/$networkConfig" -config="$serverConfig" -name="$profileName" -mod="$mods" -world=empty -port=2302 -noSound ;; stop) # Kill Screen screen -X -S ARMA kill # Kill Arma Server kill -9 arma3server ;; status) if ps aux | grep "arma3server" > /dev/null then echo "Arma 3 server is running" else echo "Arma 3 server is stopped" fi ;; restart) # Kill Screen screen -X -S ARMA kill # Kill Arma Server kill -9 arma3server # Configs directory ConfigDir="/ssd/arma3/configs" # Network settings used in -cfg param networkConfig="$ConfigDir/basic.cfg" # Server configuration settings used in -config param serverConfig="$ConfigDir/server.cfg" # Server profile and difficulty settings used in -name param profileName="server" # Server-side mods mods="" # Start server screen -S ARMA /ssd/arma3/arma3server -cfg="$networkConfig" -config="$serverConfig" -name="$profileName" -mod="$mods" -world=empty -port=2302 -noSound ;; *) esac echo "Current command: $1" Share this post Link to post Share on other sites
IT07 10 Posted August 24, 2014 Allowing this via webpage is not very safe to be honest.... The best way would be to actually start the script via a terminal. If on Windows, use Putty. If on Mac, you can use Terminal. Share this post Link to post Share on other sites
overvolts 0 Posted August 24, 2014 I am currently using putty to ssh in and run this script, the problem is I want other members to be able to start, stop, restart etc without giving them shell access. Webpage should be find as long as its secured with either apache .htpasswd or php login script authentication. Also I have looked into open source game panels like bgpanel, gamepanelx, opengamepanel etc as an alternative but haven't figured those out yet for adding an Arma 3 profile to the panels. I want some type of website solution to be able to control start, stop, restart, check server whether its a custom shell script or already developed game panel. Share this post Link to post Share on other sites
IT07 10 Posted August 24, 2014 Hmz... You can check if this fits your needs: http://www.brainless.us/ Share this post Link to post Share on other sites
overvolts 0 Posted August 30, 2014 Well I finally figured out what exactly the problem was. It was a Linux permission issue. I had to edit the sudoers config file with visudo command. I added the following to this file: www-data ALL = (root) NOPASSWD: /arma3/arma3start.sh What this does is add root privileges to Apache user (www-data) to the arma3start.sh file. Then all I had to do was add sudo in front of my php execution command. Also I found a better server control script in this thread: http://forums.bistudio.com/showthread.php?169926-Linux-Dedicated-Server-feedback&p=2725910&viewfull=1#post2725910 Hope others will find this useful. Share this post Link to post Share on other sites