If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > Unix Shell Scripts > crontab setting not working

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 04-27-07, 11:32
noordeen noordeen is offline
Registered User
 
Join Date: Apr 2007
Posts: 4
crontab setting not working

crontab we give this job. we have to servers one is working fine, other not working.

cronjob:
30 11 * * * find /{dirname} -name {filename}\*.log -atime +30 -exec rm -f {} \

Anybody know what reason not working, please tell we can try different way.

Thanks
Reply With Quote
  #2 (permalink)  
Old 04-28-07, 03:42
Tyveleyn Tyveleyn is offline
Registered User
 
Join Date: Aug 2006
Location: The Netherlands
Posts: 248
Is the cron daemon running? Check
Code:
ps -ef | grep cron | grep -v grep
should return something like
Code:
root       575     1  0 Apr19 ?        00:00:00 crond
Regards
Reply With Quote
  #3 (permalink)  
Old 04-28-07, 14:09
stolze stolze is offline
Registered User
 
Join Date: Jan 2007
Location: Jena, Germany
Posts: 2,662
Quote:
Originally Posted by noordeen
crontab we give this job. we have to servers one is working fine, other not working.

cronjob:
30 11 * * * find /{dirname} -name {filename}\*.log -atime +30 -exec rm -f {} \

Anybody know what reason not working, please tell we can try different way.

Thanks
What is "{dirname}" and "{filename}" supposed to be? If they are variables, then there is a "$" missing in front of both. Also, you have to set both variables somewhere.

What is the single trailing '\' supposed to do? There should be a ';' following to terminate the "rm" command.

You are sure that you want to have a file named "...*.log"? You are escaping the * with a backslash and don't have a forward slash there as directory separator.

What exactly does "not working" mean? cron sends emails to the owner if a cronjob produces some sort of output. Upon error, I would expect some output to occur. Check your email.

Alternatively, you could use something like this to get information on the exit status of find:
Code:
30 11 * * * find ... || echo "find failed with rc $?"
Or this to get a list of files that ought to be deleted:
Code:
find /{dirname} -name {filename}\*.log -atime +30 -print
p.s: As usual, you should first try your commands on a regular shell before putting them into crontab.
__________________
Knut Stolze
IBM DB2 Analytics Accelerator
IBM Germany Research & Development
Reply With Quote
  #4 (permalink)  
Old 04-29-07, 12:07
noordeen noordeen is offline
Registered User
 
Join Date: Apr 2007
Posts: 4
Hi!
Tyveleyn & Knut stolze,
Thanks for your kind help.
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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 Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On