Code review comment for ~dashmage/charm-logrotated:bug/2017798-update-cron-daily-location

Revision history for this message
Ashley James (dashmage) wrote :

> Thanks for working on the fix.
>
> After thinking this a bit, I am wondering why we are insist on using the
> default /etc/crontab and modify the cron.daily schedule, or copy the default
> /etc/crontab and modify the cron.daily schedule and put it under root's
> crontab. I think this is undesired because it will affect all cron jobs under
> /etc/cron.daily, not just the logrotate charm's cronjob.
>
> One of the possible alternative is to just maintain our own cron job without
> using the default crontab.
>
> For example, we can either 1. create a crontab for root user with only one
> entry, or 2. append an entry to default /etc/crontab without modifying
> original content
>
> ```
> 17 * * * * root path_to_charm_logrotate
> ```
>
> This way, we can be sure that even if we add to root user's cronjob or
> /etc/crontab, it will not have big impacts. What do you think?

Thank you for your comment!

So the requirement for using /etc/crontab is because the cron.daily job is used by the charm for managing the execution of `/etc/cron.daily/logrotate` along with charm's `/etc/cron.daily/charm-logrotate` file. This logrotate cronjob is installed by the apt package and therefore we can't modify its location (it will be overwritten). So when the charm modifies the daily cronjob time config, it also needs to modify it for the `logrotate` file. Which is why we would need to directly modify the existing cron.daily time.

« Back to merge proposal