I have a cron job that runs once a day on a Linux server and in the script it executes there is a test:
# Validate ffmpeg is installed
if [ $(which ffmpeg | grep -c "ffmpeg") -eq 0 ]; then
echo "error: ffmpeg is not installed!" | tee -a "$log"
exit 1
fi
Every day when I check the logfile, the message ffmpeg is not installed!
is in the log and as result the work has not been executed. If I run the which
test in the shell everything works fine and when I execute the script everything works.
Is there something intrinsic to cron that prevents it from being able to properly use the which
command?