Jump to content

Hello. I have set up an ArmA server and I would like someone to help me make a script or whatever so that when the server is started it runs a command. The server is headless (no GUI) so I need to do this through the command line. The server actually runs inside a Jail in FreeNas so there is no login needed.

 

To start the server I have to run 

cd /home/armash start.sh

If someone can help me automate this, that would be awesome!

 

Thanks,
Chris.

You guys are crazy. You know you guys are self-destructive. There's a funny farm somewhere and it's got your names written all over it. But I'm gettin' outta here.

Link to comment
https://linustechtips.com/topic/131606-linux-start-up-help-please/
Share on other sites

Link to post
Share on other sites

For starters, you can run it as a single command:

sh /home/arma/start.sh

 

To get it to start on server boot up, you could throw the start.sh script into /etc/init.d/ - which should run the script when the server starts up. 

 

You'll also need to set it as executable:

chmod +x /etc/init.d/start.sh

 

e: I might be a little bit off, refer to http://stackoverflow.com/questions/12973777/how-to-run-a-shell-script-at-startup for suggestions and proper methods.

Interested in Linux, SteamOS and Open-source applications? Go here

Gaming Rig - CPU: i5 3570k @ Stock | GPU: EVGA Geforce 560Ti 448 Core Classified Ultra | RAM: Mushkin Enhanced Blackline 8GB DDR3 1600 | SSD: Crucial M4 128GB | HDD: 3TB Seagate Barracuda, 1TB WD Caviar Black, 1TB Seagate Barracuda | Case: Antec Lanboy Air | KB: Corsair Vengeance K70 Cherry MX Blue | Mouse: Corsair Vengeance M95 | Headset: Steelseries Siberia V2

 

 

Link to post
Share on other sites

Thanks for the quick reply!

 

Could I use a symlink or a duplicate of start.sh and put that in /etc/init.d/?

 

It appears the top answer in the link you provided says the same as you suggested. However I'm not sure whats meant by "And put the complete location of your script in it, like /var/myscripts/start_my_app instead of just start_my_app". Would using a symblink irradiate the need for that?

 

Cheers,

Chris.

You guys are crazy. You know you guys are self-destructive. There's a funny farm somewhere and it's got your names written all over it. But I'm gettin' outta here.

Link to post
Share on other sites

Apparently, the simplest solution is to edit /etc/rc.local and throw the command before "exit 0". I can't actually confirm this, since I'm not running Ubuntu.

 

Open up /etc/rc.local and type in

"sh /home/arma/start.sh" without quotes on a newline, anywhere before "exit 0". If "exit 0" doesn't exist in rc.local, type that out on the last line - any command after it won't be executed. 

 

http://stackoverflow.com/questions/9683357/ubuntu-run-command-on-startup - for an older version of Ubuntu, but should carry over to a newer version (servers normally run Ubuntu 12.04 LTS). 

Interested in Linux, SteamOS and Open-source applications? Go here

Gaming Rig - CPU: i5 3570k @ Stock | GPU: EVGA Geforce 560Ti 448 Core Classified Ultra | RAM: Mushkin Enhanced Blackline 8GB DDR3 1600 | SSD: Crucial M4 128GB | HDD: 3TB Seagate Barracuda, 1TB WD Caviar Black, 1TB Seagate Barracuda | Case: Antec Lanboy Air | KB: Corsair Vengeance K70 Cherry MX Blue | Mouse: Corsair Vengeance M95 | Headset: Steelseries Siberia V2

 

 

Link to post
Share on other sites

I'm running 13.04. I presume it's the server version.

 

Adding "sh /home/arma/start.sh" or "/home/arma/start.sh" to  /etc/rc.local doesn't work for some reason. I made sure to run "chmod u+x /home/arma/start.sh".

 

Any ideas?

 

Chris.

 

EDIT: putting this instead works...

cd /home/armash start.sh

Thanks,

Chris.

You guys are crazy. You know you guys are self-destructive. There's a funny farm somewhere and it's got your names written all over it. But I'm gettin' outta here.

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×