Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm using vixie cron on Debian/Ubuntu. How to set a custom directory to be read by cron? I want to lead crontab to run commands found in a series of files, e.g.


or perfectly


In fact, instead of putting cron commands in /var/spool/cron/crontab/root, I want to spread commands in these folder.

Is it possible and recommended to use include for calling other files within root file?

share|improve this question
@Mat, I'm using Debian/Ubuntu; thus, the default cron is vixie, if it's what you mean. – All May 27 '12 at 8:13
up vote 5 down vote accepted

Cron in debian reads commands from 3 locations - first is users crontabs in /var/spool/cron/crontabs/$user, then it reads global /etc/crontab and then all files from /etc/cron.d.

But you can't easily have multiple crontabs per user. Only files in /var/spool/cron/crontabs are per-user. The other two are system-wide and each line contains a username, under which is the command run. You could integrate/link those individual files into /etc/cron.d, but users would be able to run commands under root or other user.

So if one crontab per user is OK, just make links from your location to /var/spool/cron/crontabs. If you need multiple per user, then you need to make a script which will take your users's cron files, and modify it for system-wide crontab (that means adding a field with their username) and adding those under /etc/cron.d.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.