Friday, November 22, 2013

@reboot in crontab

Hey folks,
I needed to run a script on startup... After looking at init.d (and having troubles with it), I finally settled in on the @reboot flag in crontabl. I was having trouble getting that working too, but I fixed it. If you are having a similar problem, here are some things you can try.


  1. Make sure that your script is executable
    • Chmod +x [yourscript]
  2. It's a good idea to log your script errors to a file to figure out why the hell it's not working
    • @reboot sudo sh /pathtoscript/foo.sh > /pathtologs/foo.log 2>&1
  3. Check /var/log/syslog  to see if crontab ran appropriately

That should get some of you started


No comments:

Post a Comment