Crontab date setting problem


 
Thread Tools Search this Thread
Operating Systems Solaris Crontab date setting problem
# 1  
Old 09-28-2012
Crontab date setting problem

Hi, i wanted to schedule a backup script to run on 7.30pm every 1st Sat of month MAR, APR, SEP, OCT.

Am i understanding it correctly? Because it doesn't seem to run according to the schedule i needed.
[30 19 1-7 3,4,9,10 6] = (7.30pm) & (1st to 7th day of the month) & (MAR, APR, SEP, OCT) & (Sat)

Code:
 30 19 1-7 3,4,9,10 6 [ "`date +\%a`" = "Sat" ] && <script>

does not seem to work properly also.



Thanks.

Last edited by beginningDBA; 09-28-2012 at 01:59 AM..
# 2  
Old 10-05-2012
You cannot use a percent sign in a cron command line. Cron interprets it as the end of line. Quoting doesn't help either. Just put the check for saturday at the beginning of your shellscript or, if this is not possible, in a separate wrapper script.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Linux

Setting Up Google 2F Authentication for Automated (Crontab) rsync

Dear All, I have Google Two Factor (2F) Authentication enabled for sshd on most of my Linux servers. This works well and I highly recommend it. My question is: Has anyone set this up for rsync which runs in a crontab? For example, supposed we have this simple crontab script: ... (5 Replies)
Discussion started by: Neo
5 Replies

2. Shell Programming and Scripting

Crontab setting

Hi All, Can anyone tell me how to schedule the dbshell.sh script to run on sunday. I have scheduled as 1 19 7 * * /home/svr/dbshell.sh. kindly confirm confirm whether coded "7" or it should set to '0'. unix:$ crontab -l 0 19 6 * * /home/svr/dbemail.sh 1 19 7 * * /home/svr/dbshell.sh (2 Replies)
Discussion started by: arun888
2 Replies

3. UNIX for Dummies Questions & Answers

Crontab setting

Hi Team, Please help me to set one script in crontab. I have one script and inside script, its creating one log file for saving ouptut of script. i have to out that script in crontab. When i put the script in cronatab, it executed and log file created but no data in log. like this i put in... (3 Replies)
Discussion started by: shivshankar
3 Replies

4. Solaris

Setting Date Variable +1 date

I need to set a date varable within ksh that will set the date to the next day in the format 25-JUL-2013 - any help would be appreciated. (3 Replies)
Discussion started by: bjdamon
3 Replies

5. Solaris

Crontab date setting problem

Hi, 0 9 1,2,3,4,5,6,7 3,4 6 I want a cronjob to run on every 1st Sat of Mar & Apr. But the above schedule is running is running on the 1st 7 days. How do i rectify it? Thanks in advance. (2 Replies)
Discussion started by: beginningDBA
2 Replies

6. Shell Programming and Scripting

Crontab setting error

Hi All, I have created crontab using following steps- 1) crontab -e (edited the file with) 0 10 * * 1-5 /home/user01/exercise/cron.sh 2) then saved this file with :wq 3) cron.sh contains the code- #!/bin/bash DAY=`date +%a` mkdir abc_${DAY} 4) done the execut permision... (3 Replies)
Discussion started by: pspriyanka
3 Replies

7. Linux

Setting up crontab, still cant get it to work

OK I have been working on this simple action for a while and I cannot get it to work. First off im new to the linux command line world. I feel like I am missing something simple. What I am trying to achieve is that I want this command: tcpdump -s2000 -w'flowroute-%H%M.pcap' -G900 -W36 &to... (13 Replies)
Discussion started by: Nasasdge
13 Replies

8. Shell Programming and Scripting

Setting the date.

I am modifying some script and need to have the script reflect the current date. I have the script below. In the section yy="2010",mm="07", dd="12" What would I need to change to have the script automatically input the current year month & date instead of manually updated the script daily? ... (2 Replies)
Discussion started by: libertyforall
2 Replies

9. UNIX for Dummies Questions & Answers

setting the system date

Okay so I'm not really a newbie, but this bugs the crap out of me (rant on). Every so often I need to change the system time. I run "man date" and always find the "date -s" command, but for who knows how long, the manual page has *never* listed the format of the input string required to set the... (1 Reply)
Discussion started by: qneill
1 Replies

10. Shell Programming and Scripting

Setting crontab

Hey all, I would like to know how to set a cron job to run from 8:15 am to 4:00 pm? Or do I have to do this in 2 seperates cron? Thanks! (4 Replies)
Discussion started by: mpang_
4 Replies
Login or Register to Ask a Question