is there a way to use multiple crontab files for one user? Thinking something along the lines of crontab file per project instead of crontab per user...
Any help is appreciated...
Super User is a question and answer site for computer enthusiasts and power users. It only takes a minute to sign up.Sign up to join this community
It's generally a good idea to maintain your crontab in a separate file anyway, and install it with
crontab filename. (I keep my crontab file in a source control system.)
You could have multiple crontab files, and install them all with
cat file1 file2 file3 | crontab
crontab command normally only manages a single crontab per user. But you can add system crontab files to the
/etc/cron.d directory. These files have an extra field after the time specification that indicates the user for the job, and you can have multiple files per user. Even if one of them has a syntax error, the others will still execute.
You'll need root access to install files in that directory.
man 5 crontab for details.
I'm not convinced that circumventing the normal crontab mechanism like this is a good idea, but it should work.
(This assumes the "Vixie Cron" implementation, which is probably what your system uses.)
NOTE: You might be tempted to try
crontab file1 file2 file3 # WRONG
but a quick experiment shows that all file names but the first are silently ignored. The man page says that a single file name is accepted, but doesn't say what happens if multiple file names are provided.