Running aide --check as a crontab job once a week

Dave748 :

I'm having real problems getting a simple (aide --check) job to run as a crontab job. I've tried everything I can think of but it won't seem to run. I've tried specifying the shell in crontab:

SHELL=/bin/bash

I've tried all kinds of variations of the command line:

*/1 * * * * root /bin/bash /usr/sbin/aide --check
*/1 * * * * /bin/bash /usr/sbin/aide --check
*/1 * * * * root /usr/sbin/aide --check
*/1 * * * * root /bin/bash /usr/sbin/aide --check >> /var/log/SystemFileCheck.log

Plus others but just can't get it to run. I've followed online guides which all say I'm doing it correctly. I've tried putting it into a bash script instead and running that but no luck. What am I doing wrong?

These are some of the errors I'm getting:

Mar 30 11:25:01 localhost CROND[14060]: (root) CMD (root /bin/bash /usr/sbin/aide --check >> /var/log/SystemFileCheck.log) Mar 30 11:25:01 localhost CROND[14058]: (root) CMDOUT (/bin/sh: root: command not found)

Mar 30 11:28:01 localhost CROND[14397]: (root) CMD (root /bin/SystemIntegCheck.sh >> /var/log/SystemFileCheck.log) Mar 30 11:28:01 localhost CROND[14395]: (root) CMDOUT (/bin/bash: root: command not found)

Mar 30 11:39:01 localhost CROND[16094]: (root) CMD (/bin/bash /usr/sbin/aide --check) Mar 30 11:39:01 localhost CROND[16092]: (root) CMDOUT (/usr/sbin/aide: /usr/sbin/aide: cannot execute binary file)

Can anyone shed some light on this?

Thanks in advance

PS. the once a minute is just for testing

ikegami :

A user id can only be specified in the system crontab file. The entries of a user's crontab file don't take a user id. The entries in question are apparently found in a user's crontab file, which is why you get root: command not found from the first, third and fourth entries.

From the second, you get cannot execute binary file because you ask bash to execute /usr/sbin/aide as a bash script when it's not a bash script. You should be using

*/1 * * * * /usr/sbin/aide --check

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=367902&siteId=1