I have several applications that weren't configured to start up automatically. I am trying to figure out a way for those services to start up automatically after a reboot.

Eg. This is one command used to start one of the applications, how do I make this into a cron job. I guess the first thing will be to stop the service after reboot then restart it.

sh /opt/activiti/tomcat/bin/./startup.sh & disown

sh /opt/activiti/nohup ./start-activiti.sh > /dev/null 2>&1 & disown

I once tried @reboot sh /opt/activiti/tomcat/bin/./startup.sh & disown which didn't work.

Any thoughts?

  • 1
    This is (almost surely) irrelevant to your problem, but you never need to say something/./another_thing; just say something/another_thing. Commented May 2, 2018 at 2:32
  • 2
    Cron is for scheduled tasks, not event-based tasks. Why aren't you configuring a systems service for your apps?
    – MikeA
    Commented May 2, 2018 at 4:42
  • 1
    I'm pretty sure you wouldn't need the & disown, since Tomcat daemonizes by itself, and if the Startup.sh has the x bit set, you don't need the sh either. Commented May 2, 2018 at 5:44
  • 1
    Was this in the global crontab /etc/crontab or your user crontab? Commented May 2, 2018 at 5:44
  • 1
    You just need someone with root access to configure the apps to start at boot. Cron is not the right tool for that. If you are going to put it in cron, you need to have it constantly checking (on a very short interval so it starts asap after reboot) if it's running and starting when you find that it isn't. But then you have to disable your cron job if/when you want the app down for an extended time for any type of maintenance work where it's not supposed to run for an extended time.
    – MikeA
    Commented May 2, 2018 at 23:48

2 Answers 2


I wrote a bash script with the start command & stop command, added it to the /etc/init.d dir then used chkconfig to set the run levels. Works like a charm.


I suggest you try the following. It seems like the reboot directive you added to crontab was not correct:

@reboot sh /opt/activiti/tomcat/bin/./startup.sh & disown

Try changing it to:

@reboot /opt/activiti/tomcat/bin/startup.sh & disown

This will make the startup.sh file located in /opt/activiti/tomcat/bin execute using the program you give it at the top of the script. Meaning, if you type:


Inside your script, this will be the program that will execute the script.

Hope it helps

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .