This is sort of a ramification of my previous thread:
Can sudoers sudo in their crontabs? - How?
(edit): But it points out other problems I'm facing using crontabs with sudo commands.
(A)
As soon as the system boots, CRON starts executing the jobs that users have in their crontabs at their due time, even if the users have not yet logged in EXCEPT those that include a sudo-command and the user can execute without the need of password identification.
The moment the user loggs in (and even out) CRON is able to execute the jobs that include sudo commands too.
Code:
cat /home/user/cron/CRON.LOG
16 Jul 23:35:03 ntpdate[20020]: adjust time server 91.189.94.4 offset -0.013027 sec
Thu Jul 16 23:35:03 CEST 2009 - ~/cron/ntpdate.sh
17 Jul 00:35:03 ntpdate[21011]: adjust time server 62.93.230.13 offset -0.007102 sec
Fri Jul 17 00:35:03 CEST 2009 - ~/cron/ntpdate.sh
<---- System Shutdown ---->
<---- System Reboot ---->
(CRON is not doing all commands in user's crontab s cript:)
Fri Jul 17 11:35:01 CEST 2009 - ~/cron/ntpdate.sh
Fri Jul 17 12:35:01 CEST 2009 - ~/cron/ntpdate.sh
Fri Jul 17 13:35:01 CEST 2009 - ~/cron/ntpdate.sh
<---- user, owner of the crontab, logged in AND OUT at 14:30 ---->
(CRON starts doing ALL commands in user's crontab script, including sudo commands:)
17 Jul 14:35:02 ntpdate[8503]: adjust time server 192.33.96.102 offset 0.079122 sec
Fri Jul 17 14:35:02 CEST 2009 - ~/cron/ntpdate.sh
As you can see, one part of the job in the crontab is not being done even if it is in the same script.
Is this how it should be?
I don't see any reason why.
Is there any way to avoid this?
According to what I have been observing around a user can never be sure if his jobs are going to be done or not until he has done all kinds of unimaginable tests.
------
(B)
A script whose filename includes a dot (file.name) placed in /etc/cron.hourly is not being done.
The same script with an underscore (file_name) in the name is done perfectly.
Is this normal?
Bookmarks