Schedule the cron job for every 21day on saturday


 
Thread Tools Search this Thread
Top Forums UNIX for Beginners Questions & Answers Schedule the cron job for every 21day on saturday
# 1  
Old 05-08-2018
Schedule the cron job for every 21day on saturday

Please guide me how to schedule the cron job to run on every Saturday at 6am with the interval of 21 days.
# 2  
Old 05-08-2018
You might be better off with the at command, rescheduling itself with each run?
# 3  
Old 05-08-2018
Code:
0 6 * * 6 lr=./lastrun; [ "`find $lr -mtime -21`" ] || { touch $lr; /path/to/real/job; }

Assuming that . (the home directory) is writable.
The find will report the file if less than 21 days old, then nothing is done.
Otherwise the file is refreshed and the job is done.
Login or Register to Ask a Question

Previous Thread | Next Thread

7 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Cron job is not running on schedule

Scheduled job is not running on time.but it is running when executing same command manually. 25 10 * * * /code/bin/ACCOUNT.ksh 1 >/dev/null 2 >&1 Manually executing the same Ksh -x /code/bin/ACCOUNT.ksh 1 >/dev/null 2 >&1 Followed steps Crontab -e Added the job to cron tab. (4 Replies)
Discussion started by: Myguest
4 Replies

2. Shell Programming and Scripting

schedule a job without Cron

Hi All, Is there any way (any utility) to schedule a job to run once in a week on RedHat Linux ? Note- Do not using Crontab. Thanks Pravin (1 Reply)
Discussion started by: pravin27
1 Replies

3. UNIX for Dummies Questions & Answers

Schedule a cron job

Hi, Can anyone help me out with scheduling a cron job for the below: i wnated to delete file from a folder on every sunday at 05:00 AM this is code i have used. ******************************************************* 0 05 * * 0 find /abc/xyz/pqrs/bak/ -type f -mtime +30 -exec rm -f... (5 Replies)
Discussion started by: ch33ry
5 Replies

4. Shell Programming and Scripting

Schedule a Cron job

Hi all, I am new to cron jobs.. i wanted to schedule a cron job that wil send a mail to me at 3:00PM on 10th August ie is on Wednesday. 0 15 10 8 3 echo "message from UNIX here"|mail -s "your subject here" user@user.com However this was not executed... Can anyone please... (0 Replies)
Discussion started by: ch33ry
0 Replies

5. Shell Programming and Scripting

Cron to schedule job at different times

Hi, I want to run cron scheduler to run some script at different times of the day.But these times don't have some fix intervals. So how we can run jobs at 6:30AM, 1:00PM and 4:30PM everyday. Please help. Thanks Neeraj (2 Replies)
Discussion started by: apjneeraj
2 Replies

6. Shell Programming and Scripting

unable to schedule job in cron

Hi, from normal user(oracle) i am unable to run scheduled job in cron: os version: bash-2.03$ uname -a SunOS sumail02 5.8 Generic_117350-39 sun4u sparc SUNW,Ultra-60 bash-2.03$ crontab -l 55 * * * * sh /oracle/statistics.sh > /dev/null 2>&1 bash-2.03$ cat /oracle/statistics.sh... (2 Replies)
Discussion started by: prakash.gr
2 Replies

7. Shell Programming and Scripting

How to Schedule job using cron(URGENT)

Hello All, I m newbie to Job scheduling. Suppose i have 2 files s1.sh and s2.sh i want to make a schedule such as run s1.sh at 2AM everyday and run s2.sh 9Pm everyday. Can anyone tell me how to schdule that using CRON and i want to know what is CRON and CRONTAB. Thanks in advance (2 Replies)
Discussion started by: ravi.sadani19
2 Replies
Login or Register to Ask a Question