Star InactiveStar InactiveStar InactiveStar InactiveStar Inactive
 

If you need to run a script when you server boots then you can do the following. I run a few scripts at startup mostly to start the game server and logging.

Write a script. put it in the /etc/init.d/ directory.
if you named the file starttf.sh

% update-rc.d  starttf.sh defaults

You also have to make the file you created executable:
chmod +x starttf.sh

 

 

sample:

First make sure you file works without being in startup. don't use relative paths for the most part.

cp /runmystuff.sh/etc/init.d/

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

update-rc.d  starttf.sh defaults

update-rc.d: warning: /etc/init.d/  starttf.sh missing LSB information

update-rc.d: see <http://wiki.debian.org/LSBInitScripts>

Adding system startup for /etc/init.d/starttf.sh ...

/etc/rc0.d/K20starttf.sh -> ../init.d/starttf.sh

/etc/rc1.d/K20starttf.sh -> ../init.d/starttf.sh

/etc/rc6.d/K20starttf.sh -> ../init.d/starttf.sh

/etc/rc2.d/S20starttf.sh -> ../init.d/starttf.sh

/etc/rc3.d/S20starttf.sh -> ../init.d/starttf.sh

/etc/rc4.d/S20starttf.sh -> ../init.d/starttf.sh

/etc/rc5.d/S20starttf.sh -> ../init.d/starttf.sh

 

Even thou you see a warning, I reboot the server and the script runs.

 

This is the content of my  starttf.sh

screen -dmS 'tf2' /steam/orangebox/srcds_run -game tf -autoupdate +map mvm_coaltown +maxplayers 32 -ip 192.168.1.22