Home Tech Geek Server Solution to: How do I get a cron.daily (or cron.hourly, cron.weekly, cron.monthly)...

Get social!

I had a couple of cronjobs (rkhunter and logrotate) that were being run from the /etc/cron.daily folder. I had set the cron.daily execution to start at 1:00 AM, as evidenced by the /etc/crontab entry:

However, I found that a couple of the jobs running from that folder were still executing too close to the opening of business. The two jobs in question were rkhunter and logrotate, both of which eat up a lot of disk I/O when running. I needed to make these jobs run earlier, but I didn't want to remove them from the cron.daily folder, as the Debian packages install them there.

Solution

I suspected that I could rename the actual script names in cron.daily to something with a higher (lower) lexical value. For instance, rename rkhunter to 1-rkhunter. I googled around a bit looking for a definitive answer, but didn't find anything. Yet people suggested as such in their posts. Bottom line, it worked. The renamed scripts 1-rkhunter and 2-logrotate start (and finish) before the other scripts now.

I'm wondering: when there is an package update for one of these applications, will the install app add the original file back to the cron.daily folder? If so, that would be bad. I'll update my post here when I find out.

Update: I didn't want to find out the hard way as to whether a software update would cause issues with the above, so I created two new scripts in the cron.daily folder, rkhunter and logrotate (the names of the original scripts). The contents of the scripts are simply:

I'm hoping that when I run an update:

The scripts will not get overwritten, or at least I'll be prompted as whether or not to overwrite.

Leave a Reply

Bad Behavior has blocked 34 access attempts in the last 7 days.