I have a script that runs forever using
watch. It is started with
watch -n1 -x /bin/bash /sh/lapse.sh &>/dev/null &, contained in the file /root/startsnap.sh. The script contains
ISMOUNTED=`mount | grep -c unit_1` if [ $ISMOUNTED -eq 1 ]; then FILENAME=/share/unit_1/public/henyard/`date +%Y%m%d%H%M%S`.jpg wget -qO $FILENAME http://10.168.0.200/ISAPI/Streaming/channels/1/picture && chmod 664 $FILENAME && chown username.groupname $FILENAME fi
When I start the script manually, it runs perfectly. However, I would like it to start at startup. To that end, I have
@reboot /bin/bash /root/startsnap.sh in crontab.
The script does not run after reboot.
journalctl does not show anything related to this. Setting up a systemd service did not work, either. Nothing seems to run.
How do I run this script at startup?