LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Slackware (https://www.linuxquestions.org/questions/slackware-14/)
-   -   slackware 13.37 and crond (https://www.linuxquestions.org/questions/slackware-14/slackware-13-37-and-crond-881035/)

sylye 05-16-2011 12:30 PM

slackware 13.37 and crond
 
Hi all my slackware friends,

After installing 13.37 for a few weeks, I found out today there are some changes on how crond being handled in 13.37:

i)in /etc/rc.d/rc.M, the log level has changed from '-l10' to '-l notice'

ii)crond no longer need to explicitly pipe to /var/log/cron using
Code:

/usr/sbin/crond -l10 >>/var/log/cron 2>&1
, and just
Code:

/usr/sbin/crond -l notice
will do, and somehow we still get log in /var/log/cron. Wonder where is the logging being done ?

iii)there is a new folder /etc/cron.d/

Now the problem is, if I put anything in /etc/cron.d/ , the cron job wouldn't get noticed by the cron daemon, and it will waite for a long time before it run the new job. What I put just a simple /etc/cron.d/beta file and the content of it is:
Code:

root@thinkphoenix:/etc/cron.d# cat beta
* * * * * date >> /root/beta.log

the file was created earlier;
Code:

root@thinkphoenix:/etc/cron.d# ll beta
-rwxr-xr-x 1 root root 33 May 17 01:08 beta*

, but the crond only pick up this a bit later:
Code:

root@thinkphoenix:/etc/cron.d# cat /root/beta.log
Tue May 17 01:16:01 MYT 2011
Tue May 17 01:17:01 MYT 2011
Tue May 17 01:18:01 MYT 2011
Tue May 17 01:19:01 MYT 2011

My friends, any idea on how to make the cron job being execute the next minute I created it ? As you know there is no start/stop cron daemon script in slackware, so do I really need to kill the cron process and start it again everytime I created a new cron job for 13.37 ?

Any sharing and discussion will be greatly welcome. You can let me know how you think about this new cron approach as well in 13.37. (Or may be it's already in 13.1 and I didn't notice that ?)

ljb643 05-16-2011 06:32 PM

Hi,

crond (dcron) is the same in Slackware 13.37 as 13.1. /etc/cron.d is for "system cron tables" - really meant for use by packaged applications that need to create their own cron table. It gets scanned once an hour (same time crond scans the per-user crontab directory, just in case it missed something). That fits with what it is meant for. For other purposes, you probably want to use the "crontab" command which manages the per-user cron tables in /var/spool/cron. The command creates a file telling crond to rescan now, so you don't have the hour latency.

On Slackware, your other option is /etc/cron.{hourly,daily,monthly,weekly}. Root can just drop scripts in there to run at the named interval. This can be easier than making up a crontab.

The change from redirecting to syslog was probably an overdue fix. Crond by default logs to syslog, so the redirection probably didn't work anyway. Using "-l notice" is the same as "-l5". If you are seeing stuff in /var/log/cron using the default syslog reporting, it is because /etc/syslog.conf sends cron messages there.

sylye 05-17-2011 08:45 AM

hi ljb643,

Thanks for taking your time to explain that for me, appreciated a lot :)

So it's me who miss out there is already /etc/cron.d in 13.1.. And that folder is for application package wise cron job and it's not meant for immediate action, I see. So if I would like to have the cronjob works immediately I should have use 'root' to make the cronjob. And thanks about the detail elaboration on the cron log part, give a clearer picture.

Overall, thanks for the feedback ;)


All times are GMT -5. The time now is 11:56 AM.