Crontab entry is not working


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Crontab entry is not working
# 1  
Old 07-27-2010
Crontab entry is not working

Hi I am trying to test the crontab entry by setting time as below ( set ahead more than 3min before saving the cron)

crontab entry:
Code:
30 15 1-27 * * [ "$(date '+%u%d')" == "227" ] && (cd /scripts;./script.csh.prod.UAT /dev/null 2>&1)

But this is not working, but below one is working.

Code:
30 15 1-27 * * (cd /scripts;./script.csh.prod.UAT /dev/null 2>&1)

Is there any error in this line?
Code:
>date '+%u%d'
227
> uname -a
Linux server 2.6.5-7.308.PTF.352368.0-smp #1 SMP Mon Dec 10 11:36:40 UTC 2007 i686 i686 i386 GNU/Linux

Please help me in this, it very urgent.

Last edited by Scott; 07-27-2010 at 04:47 AM.. Reason: Please use proper code tags
# 2  
Old 07-27-2010
Hi.

The % sign has special meaning (check the manpage for crontab(8)).

Code:
     Only the first line (up to a `%' or end of line) of the com-
     mand  field  is  executed by the shell. Other lines are made
     available to the command as standard input. Any line  begin-
     ning  with  a `#' is a comment and will be ignored. The file
     should not contain blank lines.

Escape the %'s:

Code:
30 15 1-27 * * [ "$(date '+\%u\%d')" == "227" ] && (cd /scripts;./script.csh.prod.UAT > /dev/null 2>&1)

(you also missed a redirection)
 
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Crontab - entry not working , cron job not running

I have put a cron entry in oracle user for taking hot backup every wednesday@ 2.30 AM and have given the cron entry 30 02 * * 3 /u01/vijay/hotbackupcron 2>&1 >> /u01/vijay/hotbackup.log also find below the script inside hotbackupcron, i have put in env variables as well ... (13 Replies)
Discussion started by: vijaymec50
13 Replies

2. UNIX for Dummies Questions & Answers

Crontab entry

Is this the correct entry to touch a file on 6/6 5AM? 00 05 06 06 * touch /support/home/.no_copy Please use next time code tags for your code and data (5 Replies)
Discussion started by: Me XMan
5 Replies

3. Solaris

crontab entry not working

Hi, I have added the script entry into crontab by using crontab -e. 30 * * * * /scripts/info.pl $HOME/GCSS/logs > /dev/null 2>&1 But its not working yet. Note: When i was added the script by the time I have faced issue as below 1) If I use crontab -l then i got cant open the script. ... (2 Replies)
Discussion started by: Mani_apr08
2 Replies

4. UNIX for Dummies Questions & Answers

Crontab entry

What should be the crontab entry for a script: to run at 3:00 AM EST Sun, Mon, Tue, Wed, Thu, Fri (3 Replies)
Discussion started by: proactiveaditya
3 Replies

5. UNIX for Dummies Questions & Answers

perl crontab entry not working

Hi I have a perl script which used 'glance' command to return all the processes with the thread count. It is working fine when it is executed as a command, but as a crontab entry, the perl script is not getting executed. thdcnt.pl #!/usr/bin/perl my $cmd=`glance -bootup -adviser_only... (1 Reply)
Discussion started by: manaac
1 Replies

6. Solaris

crontab entry

Hi, i need to setup a cronjob that has will execute iostat command from morning to evening time. for instance the timing has will be like this. 8:00 A.M -- 6:00P.M how to define this entry in crontab Regards (3 Replies)
Discussion started by: jaweedak
3 Replies

7. Shell Programming and Scripting

Crontab Entry

Hi Everyone , have a nice day given below is the line i have added in crontab * * * * * /Rauf/script2.sh intended to run this script after every minute , when i run this script manually it runs fine and produces output , but after adding it to crontab ( like given above ) , it doesnt work ... (5 Replies)
Discussion started by: Dastard
5 Replies

8. UNIX for Advanced & Expert Users

crontab entry

Sometimes cron really upsets me and I cant figure out these types of wierd dates, but how do I get cron to run something on every other sunday? I am running Solaris 8. -S (4 Replies)
Discussion started by: Sowser
4 Replies

9. UNIX for Dummies Questions & Answers

crontab entry

hi all how to schedule a cron job running on last day of every third month at 12 midnight will the following work 0 0 30,31 3,6,9,12 * <required file> thanks (3 Replies)
Discussion started by: matrixmadhan
3 Replies
Login or Register to Ask a Question