11 Replies - 676 Views - Last Post: 22 March 2012 - 07:45 AM

#1 olibenu  Icon User is offline

  • D.I.C Addict
  • member icon

Reputation: 45
  • View blog
  • Posts: 538
  • Joined: 31-December 08

interpretation of cron options

Posted 08 March 2012 - 04:48 AM

i have a cron job with these options: * 18 * * 1-5 to wget a url.
isn't it supposed to mean 6pm every mon-fri? how come i get over 2000 files after running it for about 2 months?
Is This A Good Question/Topic? 0
  • +

Replies To: interpretation of cron options

#2 Toadill  Icon User is offline

  • D.I.C Regular

Reputation: 45
  • View blog
  • Posts: 411
  • Joined: 08-January 12

Re: interpretation of cron options

Posted 08 March 2012 - 05:05 AM

Format

min(0-59) hour(0-23) Day of (1 - 31) Month (1- 12) Day of the week (( 0 - 6)0 = Sunday)

Crontab Example
A line in crontab file like below removes the tmp files from /home/someuser/tmp each day at 6:30 PM.

30 18 * * * rm /home/someuser/tmp/*

This post has been edited by Toadill: 08 March 2012 - 05:05 AM

Was This Post Helpful? 1
  • +
  • -

#3 olibenu  Icon User is offline

  • D.I.C Addict
  • member icon

Reputation: 45
  • View blog
  • Posts: 538
  • Joined: 31-December 08

Re: interpretation of cron options

Posted 08 March 2012 - 05:09 AM

thanks. what i want to know is:
-are my options valid? (* 18 *
* 1-5)
-do they represent what i want? (6pm, mon-fri)
-why do i have 2k+ files after 2 months?
Was This Post Helpful? 0
  • +
  • -

#4 Toadill  Icon User is offline

  • D.I.C Regular

Reputation: 45
  • View blog
  • Posts: 411
  • Joined: 08-January 12

Re: interpretation of cron options

Posted 08 March 2012 - 05:22 AM

Look at my example what do you have it set too

min(0-59) hour(0-23) Day of (1 - 31) Month (1- 12) Day of the week
____*___________*__________*_____________________*

This does look correct 6pm monday - friday

yeah 2000 files is a lot, it should only be around 300 in two months that's about 6 files extra a day

This post has been edited by Toadill: 08 March 2012 - 05:28 AM

Was This Post Helpful? 0
  • +
  • -

#5 olibenu  Icon User is offline

  • D.I.C Addict
  • member icon

Reputation: 45
  • View blog
  • Posts: 538
  • Joined: 31-December 08

Re: interpretation of cron options

Posted 08 March 2012 - 05:39 AM

could it be my command? wget -t inf url
Was This Post Helpful? 0
  • +
  • -

#6 Toadill  Icon User is offline

  • D.I.C Regular

Reputation: 45
  • View blog
  • Posts: 411
  • Joined: 08-January 12

Re: interpretation of cron options

Posted 08 March 2012 - 07:12 AM

Use the man command (% man) to see how a command is used on your particular computer.
Was This Post Helpful? 1
  • +
  • -

#7 Toadill  Icon User is offline

  • D.I.C Regular

Reputation: 45
  • View blog
  • Posts: 411
  • Joined: 08-January 12

Re: interpretation of cron options

Posted 08 March 2012 - 07:22 AM

This may be why you get more records then you expect to get
you have it set to keep trying(-t) amount of times inf(infinite)

Have a look at this link wget

You may wanna look at the -nc command instead
Was This Post Helpful? 1
  • +
  • -

#8 olibenu  Icon User is offline

  • D.I.C Addict
  • member icon

Reputation: 45
  • View blog
  • Posts: 538
  • Joined: 31-December 08

Re: interpretation of cron options

Posted 09 March 2012 - 06:43 AM

thanks. i used -t incase of any errors. i'll remove it. no clobber doesn't fit my need.
Was This Post Helpful? 0
  • +
  • -

#9 wordswords  Icon User is offline

  • D.I.C Regular
  • member icon

Reputation: 76
  • View blog
  • Posts: 272
  • Joined: 17-December 11

Re: interpretation of cron options

Posted 11 March 2012 - 04:14 AM

You might also want to use fully qualified paths, for example:

/usr/bin/wget <options> /tmp/outputfile.htm

I find if I don't use fully qualified paths, sometimes my cron jobs don't run properly. I would also enclose the command in quote marks, ie:

"/usr/bin/wget <options> /tmp/outputfile.htm"
Was This Post Helpful? 0
  • +
  • -

#10 olibenu  Icon User is offline

  • D.I.C Addict
  • member icon

Reputation: 45
  • View blog
  • Posts: 538
  • Joined: 31-December 08

Re: interpretation of cron options

Posted 17 March 2012 - 12:26 AM

the job runs. My problem is that it runs too much.
After removing the -t inf switch and thinking my problems where solved, cron sent me 200 mails just for one day! (it was supposed to be 1). I read through the manual (link in post above) and saw something interesting: the --ignore-length switch. I've set that now and will see what will happen.
Is there any way the problem lies with cron? Does cron send mail once for each time the job runs or something else?
Was This Post Helpful? 0
  • +
  • -

#11 no2pencil  Icon User is offline

  • Admiral Fancy Pants
  • member icon

Reputation: 5392
  • View blog
  • Posts: 27,387
  • Joined: 10-May 07

Re: interpretation of cron options

Posted 17 March 2012 - 06:11 PM

View Postolibenu, on 17 March 2012 - 03:26 AM, said:

Is there any way the problem lies with cron? Does cron send mail once for each time the job runs or something else?

Cron launches whatever you tell it to, when you tell it to. It's simply a task scheduler.
Was This Post Helpful? 0
  • +
  • -

#12 olibenu  Icon User is offline

  • D.I.C Addict
  • member icon

Reputation: 45
  • View blog
  • Posts: 538
  • Joined: 31-December 08

Re: interpretation of cron options

Posted 22 March 2012 - 07:45 AM

tried to wipe duplicates using find -type f -exec md5sum '{}' ';' | sort | uniq --all-repeated=separate -w 33 | cut -c 35- > dupes.txt parsing dupes.txt to remove the first of every duplicate and then cat resultingfile.txt | xargs rm which gave me just 5 files. something is wrong!
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1