Skip to content
View in the app

A better way to browse. Learn more.

Unraid

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

A request for help with Cron

Featured Replies

I schedule cron jobs by placing scripts in /etc/cron.daily an /etc/cron.hourly.

 

This has worked for years with no issue.  I noticed yesterday that recently my cron jobs have stopped running. 

 

I hope someone can help me. 

 

The scripts are in the correct location (i.e. /etc/cron.daily)  I found the crontab file on my server is located in /tmp and when I cat it it looks Okay.

 

I did notice that if I try to 'crontab -l' I get an error "no crontab for root".  This looks like it might be a problem. but, I don't know.

 

Also, I tested by firing the scripts manually.  They still do their job with no error.  It is just that they are no longer running as scheduled via cron.

 

Please, I could use some advice from anyone with cron knowledge. 

 

 

The file you're looking for (where it is in my system) is /var/spool/cron/crontabs/root

The file you're looking for (where it is in my system) is /var/spool/cron/crontabs/root

if you can read the crontab file in /tmp, try

cat  /tmp/crontab | crontab

 

then try

crontab -l

 

You probably typed crontab and then quit without supplying one, basically emptying it.

 

Joe L.

  • Author

Please excuse my ignorance.  For some reason cron configuration has me scratching my head.  It worked before and now it doesn't.

 

Peter - I checked...  I have a /var/spool/cron/crontabs, but it doesn't contain a 'root' subdirectory.  Should it?

 

Joe - I tried as you said.  I assume that "cat  /tmp/crontab | crontab" should pipe the crontab contents from the /tmp/ location to the root's crontab file (wherever that might be located).  But, when I subsequently issued a "crontab -l" the response is still "no crontab for root"

 

 

 

 

Peter - I checked...  I have a /var/spool/cron/crontabs, but it doesn't contain a 'root' subdirectory.  Should it?

 

'root' should be a file containing all the crontab lines for the root user.

  • Author

Peter - I checked...  I have a /var/spool/cron/crontabs, but it doesn't contain a 'root' subdirectory.  Should it?

 

'root' should be a file containing all the crontab lines for the root user.

 

No files exist at that location.  Should I copy the crontab file that is in my /tmp directory to this location and name it 'root'?

Peter - I checked...  I have a /var/spool/cron/crontabs, but it doesn't contain a 'root' subdirectory.  Should it?

 

'root' should be a file containing all the crontab lines for the root user.

 

No files exist at that location.  Should I copy the crontab file that is in my /tmp directory to this location and name it 'root'?

just reboot.  That will re-create the default crontab file.

(unless you want to give it a try otherwise without rebooting.  The actual crontab is in memory and only read when needed.  In that case, perhaps since the file is missing it is unable to accept the new crontab commands.

 

Joe L.

As Joe says, that file should be created/placed in the correct position at boot time.  If it is missing, something has removed it - a user action, or an add-on of some sort.  Some simple testing, starting with a standard, 'vanila' install should allow you to identify the culprit.

  • Author

Thank you Peter & Joe. 

 

I was able to find the cause and have fixed my issue.  But, the most important thing is that I learned a little bit more about how cron works.  The big clue for me was that there WAS supposed to be a file called 'root' at /var/spool/cron/crontabs.  Next time I have cron issues I'll have a much easier time finding the solution myself.

 

Cheers!

Archived

This topic is now archived and is closed to further replies.

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.