I'm on Debian 9.5 and have the following /etc/cronjob.weekly/rkhunter file :
#!/bin/sh
OUTPUT=`rkhunter --cronjob --report-warnings-only`
if [ "$OUTPUT" != "" ]
then
echo $OUTPUT | mail -s "[rkhunter] Warnings found for $(hostname)" root@youremail
fi
Of couse, I have changed the mail with my real one.
When I execute sudo /etc/cronjob.weekly/rkhunter to test it, it doesn't work. Could you help me to have this cron work?
EDIT to clarify: I have set a cronjob to have Rkhunter send me weekly reports on my mail address. To test it, I can execute directly sudo /etc/cronjob.weekly/rkhunter
and it will execute the cronjob and send me the mail. However, when I execute the command, it doesn't send me the mail, so I guess something is wrong in the file.