LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 03-24-2005, 03:44 PM   #1
branden_burger
Member
 
Registered: Dec 2004
Posts: 66

Rep: Reputation: 15
crond problem


what happens if I put in a */100 in the minutes field of /etc/crontab for a certain command to be run? I mean, my intention was to run it every 100 minutes, but it turns out that you can only have integers from 0-59 in that field.

thanks
 
Old 03-25-2005, 03:57 AM   #2
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985
well it never runs, as there's no hundredth minute... maybe run it every 120 minutes? so for hours it's */2
 
Old 03-25-2005, 11:15 AM   #3
homey
Senior Member
 
Registered: Oct 2003
Posts: 3,057

Rep: Reputation: 61
The results may suprise you.

I made a little script and ran it as root user ( su - ) in my crontab.
First, I ran it every minute
* * * * * /home/test

This also ran every minute
*/1 * * * * /home/test

Then I ran it every ten minutes
*/10 * * * * /home/test

Then I put in the */100

*/100 * * * * /home/test

The first thing I noticed was this message...

# crontab -e
crontab: installing new crontab
You have new mail in /var/spool/mail/root

I checked the mail and it's not an error message,
but the fact that it sends an email when I used the bogus input
indicates that the crontab may be confused.

As this partial ls -al shows, the new cron job now ran at every hour
I guess that the minutes field is ignored because it is invalid. That field needs to be a value between zero and 59 .
Code:
-rw-r--r--   1 root   root   3177714 Mar 25 10:30 1030.tar.gz
-rw-r--r--   1 root   root   3177714 Mar 25 10:40 1040.tar.gz
-rw-r--r--   1 root   root   3177714 Mar 25 11:00 1100.tar.gz
-rw-r--r--   1 root   root   3177714 Mar 25 12:00 1200.tar.gz
Code:
 
#!/bin/bash
filename=`date '+%H%M'`
cd /home/images

/bin/tar -cvzf /home/${filename}.tar.gz .

Last edited by homey; 03-25-2005 at 01:48 PM.
 
Old 03-25-2005, 05:03 PM   #4
branden_burger
Member
 
Registered: Dec 2004
Posts: 66

Original Poster
Rep: Reputation: 15
Well, what do you know, that's what I found out too! Nice - in case you do have a job which is critical to have done, it doesn't not do it at all.

Thanks!
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
crond problem,after success run the job,will mailto root singying304 Linux - Software 1 11-29-2005 05:33 PM
Crond is stubborn... Worstje Slackware 20 07-10-2005 08:10 AM
problem running crond wakeupatul Linux - General 1 04-20-2004 01:28 PM
more than one instance of crond plisken Slackware 2 04-18-2004 12:30 PM
Crond jimval7 Linux - General 2 03-06-2002 11:28 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

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

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration