This question already has an answer here:
What am I doing wrong here with cron on boot?
To launch manually: screen -S example ./script.sh
To recover manually: screen -x example
now, I just try to do the same thing (well, the launch part) using cron on boot
@reboot cd /home/administrator/script && screen -S example ./script.sh
I think it works without screen. For example:
@reboot cd /home/administrator/script && ./script.sh
but I also need this to run in the background, independent of the terminal. I have tried other options such as init, init.d, but there seems to be a lot of confusion out there on how it all works on which versions of linux. If you can fix my error above or show me a better solution, that would be great.
I am using Ubuntu 12.04.2 LTS
* UPDATE *
So in response to Jan Wikholm, I have tried the absolute path and that completely fails.
If I test this in the console:
screen -S example /home/administrator/script/script.sh
The script does not execute. Am I missing something conceptual here?
I get the screen error message [screen is terminating] immediately
* SOLUTION *
Finally figured it out. The issue with screen was the path to the executable.
Here is the final crontab entry that works like a charm
@reboot cd /home/administrator/script && /usr/bin/screen -dmS example ./script.sh
Thanks for the help Jan