0

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.

Zuriel
  • 101

1 Answers1

0

Edit your crontab entry like so, as user that's supposed to run script:

# crontab -e

Add this line:

@daily /path/to/script.sh

Write and quit (press :wq:

:wq

Remove script from /etc/cron.daily/rkhunter.

yahol
  • 81