1

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?

  • This is (almost surely) irrelevant to your problem, but you never need to say something/./another_thing; just say something/another_thing. – G-Man Says 'Reinstate Monica' May 2 '18 at 2:32
  • 1
    Cron is for scheduled tasks, not event-based tasks. Why aren't you configuring a systems service for your apps? – MikeA May 2 '18 at 4:42
  • 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. – Ulrich Schwarz May 2 '18 at 5:44
  • Was this in the global crontab /etc/crontab or your user crontab? – Ulrich Schwarz May 2 '18 at 5:44
  • @MikeA the cicd guys didnt configure the application to start automatically after reboot. they are now gone and I am trying to be proactive to find other means of doing it – bonafideaf May 2 '18 at 15:27
0

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.

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.