Is the root crontab the only way? I'm starting up a MC server and don't want it to need me to manually restart it each time the server reboots for whatever reason. I don't want any login required for these programs to initialise.

I'm using ssh to get into this server, it's a VPS, nothing local.


There are more than one way to accomplish this.

  1. You can put your startup script in /etc/init.d and make it resemble to one of the existing scripts over there. But depending on your Linux comfort level, this may be a little daunting.

  2. You can make this a service and make the service start at the boot time. Just do a google search on "how to make my program a service" and you will come across a lot of pages. More than what you can shake a stick at.

  3. If your app is startin g with one single command and is not dependent on anything else, you can add the start-up command at the end of /etc/rc.local file.

You can also put it in the cron to execute at the startup but this is not the way it should be done, in my opinion

  • Thanks! The original advice I was given from a web page was to run the following... @reboot cd ~/McMyAdmin && screen -dmS McMyAdmin ./MCMA2_Linux_x86_64 ...sadly it didn't work using my non-root account. – Daniel T Mar 18 '16 at 19:26

Ubuntu normally has Vixie cron installed. You can use @reboot for a normal user's crontab file. From the man page:

Instead of the first five fields, one  of  eight  special  strings  may

          string         meaning
          ------         -------
          @reboot        Run once, at startup.
  • The advice I was given was to add this to the crontab... @reboot cd ~/McMyAdmin && screen -dmS McMyAdmin ./MCMA2_Linux_x86_64 ...but sadly it didn't work. :( – Daniel T Mar 18 '16 at 19:24
  • 1
    You should at least expand the paths (not use ~). Or better make a script in which you do everything, assuming your PATH is only /usr/bin:/bin and then call that script from the crontab. – Anthon Mar 18 '16 at 19:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.