Take the 2-minute tour ×
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.

I want to set a personal crontab in another folder and executed.

For example I want it in /home/project/tasks/crontab

Like that it's easier to add/delete tasks.

Thank you for your answers.

share|improve this question

1 Answer 1

up vote 2 down vote accepted

The cron daemon determines where your active crontab is stored. On my system (Ubuntu), and probably on yours, it's under /var/spool/cron/crontabs/.

But you can maintain your crontab entries anywhere you like. Just remember to run

crontab /home/project/tasks/crontab

every time you update it.

(I suppose you could set up a cron job to do that for you. Disclaimer: I haven't actually tried invoking crontab from a cron job; I'm not 100% sure it would work.)

I personally find that a lot easier to manage than using, say, crontab -e; I can maintain my crontab file under a source control system, so I don't lose anything if I accidentally do crontab -r, for example.

DIGRESSION :

I suppose you could set up a cron job to do that for you. Just as an experiment, I tried setting up a crontab with the following command:

* * * * *    crontab .crontab

After manually running crontab .crontab once, changes in $HOME/.crontab were automatically applied after I saved the file, taking effect one to two minutes later.

But personally I'd much rather just run crontab FILENAME manually, so I don't have to worry about what will happen if I save an intermediate version of the file.

share|improve this answer
    
Thank you for your answer, I'll try all this. the thing is that the crontab is a shared one on SVN, and all dev doesn't have access to the server so can't launch it. In my ex company I just needed to update the crontab and it loaded everything automaticly. I'll try your methods. –  user1040899 Feb 16 '12 at 2:14

Your Answer

 
discard

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.