Skip to content
Advertisement

crontab @reboot does not execute bash script when server is rebooted

I’m using @reboot ~/www/example.com/bin/server in my user’s crontab…but when I reboot the server, the web server (this script) does not come up. (script works fine from command line).

My guess is the /home/user directory has not been mounted yet…does anyone know if its possible to get a script to run out of a home directory using this crontab @reboot method?

Advertisement

Answer

My problem was that the crontab did not have a full environment. I made the script it was pointing to source my .bashrc.

@reboot /home/user/www/example.com/bin/server

./server does . /home/user/.bashrc to get a working environment.

User contributions licensed under: CC BY-SA
3 People found this is helpful
Advertisement