Hi,
I'm trying to package a cron file after reading [1], but I am wondering what the best approach is to run a cronjob not as root while still using the /etc/cron.daily folder.
Using /etc/cron.d would be an option, as that allows to run jobs as different user, but maybe this is not the nicest...
I could use "sudo" in the shell script, but this feels ugly as well. Any thoughts?
Cheers, François
Is there any reason you can't specify the user instead of root in the cron file?
Randall Wood Alexandria Software randall.h.wood@alexandriasoftware.com http://alexandriasoftware.com
On Nov 17, 2016, at 10:27, François Kooman fkooman@tuxed.net wrote:
Hi,
I'm trying to package a cron file after reading [1], but I am wondering what the best approach is to run a cronjob not as root while still using the /etc/cron.daily folder.
Using /etc/cron.d would be an option, as that allows to run jobs as different user, but maybe this is not the nicest...
I could use "sudo" in the shell script, but this feels ugly as well. Any thoughts?
Cheers, François
[1] https://fedoraproject.org/wiki/Packaging:CronFiles _______________________________________________ packaging mailing list -- packaging@lists.fedoraproject.org To unsubscribe send an email to packaging-leave@lists.fedoraproject.org
On 11/17/2016 04:31 PM, Randall Wood wrote:
Is there any reason you can't specify the user instead of root in the cron file?
Well, I can, but:
[quote] Packages with cron job files must place those cron job files into one or more of the following directories /etc/cron.hourly, /etc/cron.daily, /etc/cron.weekly, /etc/cron.monthly depending on the intended interval they should run.
There is an exception to this rule: If a certain cron job has to be executed at some frequency or at a specific time interval other than the above, then a custom crontab file should be added to /etc/cron.d (with 0640 permissions). [/quote]
Running it as a different user is not specified as a reason to use cron.d :-)
Cheers, François
"FK" == François Kooman fkooman@tuxed.net writes:
FK> [quote]
It's good to say exactly what you're quoting so that other people can read your quote in context.
FK> Running it as a different user is not specified as a reason to use FK> cron.d :-)
And if we had to list every possible exception to every single rule, the guidelines would be a thousand lines long and nobody would ever bother to follow them.
Please read http://fedoraproject.org/wiki/Packaging:Guidelines#General_Exception_Policy
from which I'll quote:
" As these guidelines can never cover all possible contingencies, there will always be packages which need exceptions. It is the packager's responsibility to follow these guidelines as closely as is feasible and to clearly document, as comments in the package specfile, instances where they cannot be followed. "
- J<
On Thu, Nov 17, 2016 at 04:27:47PM +0100, François Kooman wrote:
I'm trying to package a cron file after reading [1], but I am wondering what the best approach is to run a cronjob not as root while still using the /etc/cron.daily folder.
One possibility would be to use `su -c` in your script in /etc/cron.daily. This preserves the advantage of flexible timing.
On 11/18/2016 04:36 PM, Matthew Miller wrote:
One possibility would be to use `su -c` in your script in /etc/cron.daily. This preserves the advantage of flexible timing.
Yeah, that is what I was investigating before, but because the user in question (apache) does not have a shell that doesn't seem to work so well, maybe you can override this again, but that would not make stuff any cleaner.
I solved it now by placing a file in /etc/cron.d and also using the RANDOM_DELAY option there.
Cheers, François
packaging@lists.fedoraproject.org