The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
Google UNIX.COM


UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !!

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Running UNIX Commands from C zainab High Level Programming 2 04-14-2008 08:35 PM
Mail not recieved when running from Crontab pankajkrmishra Shell Programming and Scripting 11 08-11-2006 12:04 AM
How to disable running commands from vi Umesh_Sharoff Shell Programming and Scripting 1 07-14-2006 09:05 AM
differnce between working of at and crontab commands doddas UNIX for Dummies Questions & Answers 2 05-04-2005 12:17 PM
running sql in crontab dorilevy UNIX for Dummies Questions & Answers 4 08-22-2002 04:13 AM

Reply
 
Submit Tools LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 08-07-2008
Registered User
 

Join Date: Jun 2008
Posts: 31
Stumble this Post!
Running commands dynamically in crontab

Hello people,
I am trying to run a script in crontab like this:
15 05 * * * /home/apps/DOLLS.sh `date +%Y%m%d`
But it is not taking the runtime argument.
Am I committing any mistake or is there any way we can run commands on the fly in from crontab?
Reply With Quote
Forum Sponsor
  #2 (permalink)  
Old 08-07-2008
ynilesh's Avatar
Registered User
 

Join Date: Oct 2007
Location: Bangalore, India.
Posts: 174
Stumble this Post!
I cant understand what you are trying to do ?

- nilesh
Reply With Quote
  #3 (permalink)  
Old 08-07-2008
Registered User
 

Join Date: Jun 2008
Posts: 31
Stumble this Post!
My scripts DOLLS.sh takes today's date as a run time argument. So I am trying to pass today's date when I am trying to run it from crontab but it is not taking it. Instead I am getting a blank in its place.
Thanks.
Reply With Quote
  #4 (permalink)  
Old 08-07-2008
ynilesh's Avatar
Registered User
 

Join Date: Oct 2007
Location: Bangalore, India.
Posts: 174
Stumble this Post!
I tried on my hosts....
somehow cron not able to understand % character. so it does not proceed after that. Need to check what we can do.

I found this in log.
Quote:
/USR/SBIN/CRON[7883]: (root) CMD (/root/today_date.sh `date +)
- nilesh
Reply With Quote
  #5 (permalink)  
Old 08-07-2008
vgersh99's Avatar
Moderator
 

Join Date: Feb 2005
Location: Boston, MA
Posts: 3,002
Stumble this Post!
'man crontab' and search for '%'
Code:
15 05 * * * /home/apps/DOLLS.sh `date +\%Y\%m\%d`
Reply With Quote
  #6 (permalink)  
Old 08-07-2008
broli's Avatar
Registered User
 

Join Date: Dec 2007
Location: Argentina
Posts: 199
Stumble this Post!
edit the sh to read the date from a config file
Reply With Quote
  #7 (permalink)  
Old 08-08-2008
Registered User
 

Join Date: Jul 2008
Posts: 26
Stumble this Post!
Hi ,Rajat,

I think , u can try what vgersh99 has said. The "\" might work.

Kindly post whether it had worked or not......
Reply With Quote
Google The UNIX and Linux Forums
Reply

Thread Tools
Display Modes




All times are GMT -7. The time now is 10:21 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008 The CEP Blog All Rights Reserved -Ad Management by RedTyger Visit The Global Fact Book

Content Relevant URLs by vBSEO 3.2.0