jamesrwhite / minicron

🕰️ Monitor your cron jobs
GNU General Public License v3.0
2.34k stars 154 forks source link

Refactor crontab interaction #165

Closed jamesrwhite closed 8 years ago

jamesrwhite commented 8 years ago

Rather than replacing/searching for individual lines which is complicated and error prone the full crontab can be built on the server side and the file simply replaced completely. This probably rules out support for /etc/crontab seeing as at that might replace entries placed in there by the OS but I wanted to not require that anyway. A nicer solution is putting something in /etc/cron.d that is for minicron exclusively. Related to https://github.com/jamesrwhite/minicron/issues/74.

robinjoseph08 commented 8 years ago

I'm excited to see this pan out, but I'm curious if it'll be possible to have certain environment variables set at the beginning of the crontab. With the current implementation, since it only modifies lines at a time, I was able to set a few configuration envs at the top of the file that trickle down into the cron commands themselves. With this still be possible with this new setup?

jamesrwhite commented 8 years ago

I hadn't considered that use case. I could add the ability to assign key/value params to a host which would be set as ENV bars when the crontab is built, would that work for you?

robinjoseph08 commented 8 years ago

Yup, that'd be perfect. :+1: Even better than my current implementation since right now, if I wanted to add a new ENV, I'd have to ssh in and edit it.