joh/when-changed

Unable to run via crontab

Closed this issue · 2 comments

This is the command in my crontab

@reboot sh /home/pi/project2/mainfile.sh >> /home/pi/project2/mainfile.log 2>&1

mainfile.sh

#!/bin/sh
when-changed /media/SAIF16GB/shares/ytvideolist.txt -c sh /home/pi/yt-dl/videodl.sh & >> /home/pi/yt-dl/QQQQ.log
when-changed /media/SAIF16GB/shares/ytpllist.txt -c sh /home/pi/yt-dl/playlistdl.sh &

But its not working and log file says that command not found

/home/pi/project2/mainfile.sh: 2: /home/pi/project2/mainfile.sh: when-changed: not found
joh commented

Looks like when-changed is not in $PATH. Try adding it to PATH in the beginning of mainfile.sh.

Just sorted it out by changing the when-changed to /usr/local/bin/when-changed.

Thanks for the amazing script. It helps me a lot. I have assigned it cron to run it at the boot time and have an eye on the youtube batch file list. Whenever I add a new video or a playlist in the txt file it triggers youtube-dl.