I put a rkhunter script in daily.cron on Apache Centos 7.
When I manually run the script, it works fine. but leaving it in daily.cron it fails to run.
I get this email every day instead.
/etc/cron.daily/rkhunter:
/etc/cron.daily/rkhunter: line 3: rkhunter: command not found
if you look in cron.daily you see a rkhunter script. inside that script this is the contents.
#!/bin/sh
OUTPUT=`rkhunter --update --cronjob --report-warnings-only --nocolors --skip-keypress`
if [ "$OUTPUT" != "" ]
then
echo $OUTPUT | mail -s "[rkhunter] Warnings found for $(hostname)" email@example.com
fi
if i manually run
sh rkhunter
from that directory it works. I tried to have a file extension on it rkhunter.sh but it was the same result so with or without the .sh extension i am not sure it makes a difference.
How can I get this script to run daily and not fail with command not found.