Cronjob not running

Hello i am trying to run a cronjob as root. I have entered the cronjob. Using sudo crontab -lshows no crontab for root. But using sudo nano crontab -e shows the command. The following is the line of the cronjob:

18 13 * * * root /usr/bin/rkhunter --cronjob --update --quiet

If anyone can help me get this running it would be great.

Thanks and keep leaping


sudo crontab -e is what you probably want. sudo nano crontab -e is probably editing a file name crontab in the current directory.



Thanks this is very true. After using the command you stated is replied

[frog@frog ~]$ sudo crontab -e
no crontab for root - using an empty one
crontab: installing new crontab

and sudo crontab -l does display the command now but it does not run.

Actually systemctl status cronie has returned

Apr 06 19:35:01 frog crond[202764]: (root) CAN'T OPEN (/etc/crontab): No such file or directory

Is that timestamp from before or after you created a crontab?

Have you tried restarting cronie?

The time is just the time at which I set the cronjob to run. I will restart cronie.

I got this output after restarting cronie and testing it again.

Apr 06 19:47:01 frog crond[375380]: pam_unix(crond:session): session opened for user root(uid=0) by (uid=0)
Apr 06 19:47:01 frog CROND[375381]: (root) CMD (root /usr/bin/rkhunter --cronjob --update --quiet)
Apr 06 19:47:01 frog CROND[375380]: (root) CMDOUT (/bin/sh: line 1: root: command not found)
Apr 06 19:47:01 frog CROND[375380]: (root) CMDEND (root /usr/bin/rkhunter --cronjob --update --quiet)
Apr 06 19:47:01 frog CROND[375380]: pam_unix(crond:session): session closed for user root

It has been ages since I have setup a cronjob since systemd timers have mostly replaced cron at this point.

However, I think it should be like this if it in the root crontab:

18 13 * * * /usr/bin/rkhunter --cronjob --update --quiet
1 Like

Yes, it is working now thanks. i will look into the timers.

Many Thanks,

Happy Frog