2

I have an app that has some functionalities that are scheduled via crontab.

Is there any way for me to keep these crontab-launched commands in a git repository, and at the same time add them to the user's crontab?

My first thought was to add * * * * * crontab /home/user/git_repository/crontab as a new line in crontab -e, so that it always automatically sources it, but crontab -h says that (default operation is replace, per 1003.2), while I just want my special crontab to be processed in addition to the user's crontab, so I'm not sure if that's the correct way to do this.

1 Answer 1

0

First, the question. Crons are stored in "/var/spool/cron/crontabs" or the such, depending on distro. You could add that to git (maybe just your user's crontab, not the whole directory), but you need root access for that. I think you might need to restart cron for it to reload crontab if you manually update it.

Second, the error seems like an exclusive lock. Apparently, you cannot crontab while crontab, which makes sense in order not to overwrite.

For system level sync and stuff, I use ansible, but that might be overkill just for this small task.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .