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?

  • @Mat, I'm using Debian/Ubuntu; thus, the default cron is vixie, if it's what you mean.
    – Googlebot
    May 27, 2012 at 8:13

1 Answer 1


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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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