How to add a startup script for reboot / startup

Asked by charlier

Hi,

I've been trying to run startmud from boot up so if the server reboots or shuts down for whatever reason, it will just start up everything again when the server comes back up.

Normally I just put a quick 1 liner in my /etc/rc.local like this

nohup /usr/local/mudos/etc/startmud > /dev/null 2>&1 &

But doing so is not working. I've also tried this...

1.) I have also tried using full links in the configuration file.
2.) I have tried with and with out the nohup
3.) I have tried with and with out the '&'
4.) I have tried creating a script that would switch users to root, cd into the directory, and then run it. * This worked kind of, but it started to many instances of it and spiked my cpu usage to 30%. I think it's the log writing that is causing that spike.

It seems I can get it to start by hand by following these steps...

Login,
cd /usr/local/mudOS/etc
nohup ./startmud &

That usually gets it going and keeps it going.

The problem seems that if your not launching this from inside the mudos directory it's not liking it.

Do you guys have any suggestions on the right way to get this to autostart? This is running on a CentOS-5 linux box. I do have user and root access.

Question information

Language:
English Edit question
Status:
Solved
For:
Sapidlib Edit question
Assignee:
No assignee Edit question
Solved by:
charlier
Solved:
Last query:
Last reply:
Revision history for this message
Richard Thomas Harrison (harrison-rt) said :
#1

The startmud script uses relative paths and not absolute paths. To make it work in you rc.local file do this...

pushd /usr/local/mudos/etc
nohup ./startmud &
popd

Revision history for this message
charlier (charlie-reddington) said :
#2

Thanks so much, that totally worked.