Sponsored Content
Full Discussion: Run script on particular day
Top Forums Shell Programming and Scripting Run script on particular day Post 303025090 by bakunin on Wednesday 24th of October 2018 06:16:36 AM
Old 10-24-2018
Quote:
Originally Posted by rohit_shinez
what if script_1.sh fails then if i rerun the main_script.sh it should run only script_1.sh . For eg script_1.sh fails on 25th and re-running on 26th in that case script_1.sh will not run and other script_2.sh will also run which would have completed being daily job
I suggest reading up on the test- command (this is effectively what [..] is). You have many possibilities to formulate various conditions on when and when not to run a script, you just need to implement them. It is far easier and in the long run less time-consuming for you to learn that (takes about 10 minutes) than to ask over and over again like you are doing now.

But first you should define what "script fails" means: does it exit with a non-zero return code? Does it write a log with an error message? Does it (not) produce a file? The secret of writing good scripts is to first make up your mind what exactly you want to do and under which conditions, then to define exactly what it is you want to do: "i need a file today" is less exact than "i need a file every second friday of the month" and this in turn is less exact than "i need a file every second friday only if this other file is up to date execpt for ....". Nobody here knows what you need as well as you do, so do your work first and we will gladly help with the rest.

I hope this helps.

bakunin

Last edited by bakunin; 10-24-2018 at 07:23 AM..
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Write a shell script to find whether the first day of the month is a working day

Hi , I am relatively new to unix... Can u pls help me out to find out if the first day of the month is a working day ie from (Monday to Friday)...using Date and If clause in Korn shell.. This is very urgent. Thanks for ur help... (7 Replies)
Discussion started by: phani
7 Replies

2. UNIX for Dummies Questions & Answers

cron script -run every 2nd day of month except Monday

I know I can't schedule this in cron and would have to write a wrapper around my script and schedule it in cron ....but not sure how do to this? How do I exclude Monday if the 2nd day of the month falls on a Monday? Thanks. I tried this: 0 0 2 * 0,2-6 command And I know this doesnt... (2 Replies)
Discussion started by: newtou
2 Replies

3. Shell Programming and Scripting

crontab entry to run every last day of the month

i've created a script which should run every last day of the month. what would be the exact crontab entry for this? thanks! (9 Replies)
Discussion started by: tads98
9 Replies

4. Shell Programming and Scripting

Script to find previous month last day minus one day timestamp

Hi All, I need to find the previous month last day minus one day, using shell script. Can you guys help me to do this. My Requirment is as below: Input for me will be 2000909(YYYYMM) I need the previous months last day minus 1 day timestamp. That is i need 2000908 months last day minus ... (3 Replies)
Discussion started by: girish.raos
3 Replies

5. AIX

kill process that run more then 1 day

hi all i need a script which will find all the processes witht the name of xxx and kill all those processes that runs for more than 1 day. Regards (3 Replies)
Discussion started by: Elii
3 Replies

6. Shell Programming and Scripting

Script to check if last modified day is previous day

Hi, I would like to write a script that checks if a file ('counter') was modified the previous day, if so erase its contents and write 00000000 into it. For e.g. if the file 'counter' was last modified at 11.30pm on 24th May and the script runs at 12.15am of 25th May, it should erase it's... (1 Reply)
Discussion started by: hegdepras
1 Replies

7. Shell Programming and Scripting

run the script for last day of the month

Hello Experts, I have a script which i want to run the on last day of every month. let say I have backup.sh script which i want to run it every month last day. Can anyone please help :confused: thanks (4 Replies)
Discussion started by: aks_1902
4 Replies

8. Shell Programming and Scripting

Writing a script to run weekly/monthly - check for weekday or day-of-the-month

Hi all, I currently have a UNIX file maintenance script that runs daily as a cron job. Now I want to change the script and create functions/sub inside it that runs on a weekly or monthly basis. To run all the scripts' daily maintenance, I want to schedule it in cron as simply maint.sh... (1 Reply)
Discussion started by: newbie_01
1 Replies

9. UNIX for Advanced & Expert Users

Run A Job in Cron On A Specific Day Excluding Holidays

Hi, I want to run a job in cron on a specific date(say 25th of every month) excluding holidays. Can anyone provide some hints to do this? Thanks for any inputs. (1 Reply)
Discussion started by: sktkpl
1 Replies

10. Shell Programming and Scripting

Script to run on 2 4 and 7 day of the month

I am looking for a unix script which could run a job on 2, 4 and 7 working day of the month. if the days are falling on the saturday/sunday. it should run on the next day. Thank you.. (9 Replies)
Discussion started by: tradingspecial
9 Replies
qrerun(1B)								PBS								qrerun(1B)

NAME
qrerun - rerun a pbs batch job SYNOPSIS
qrerun [-f] job_identifier ... DESCRIPTION
The qrerun command directs that the specified jobs are to be rerun if possible. To rerun a job is to terminate the session leader of the job and return the job to the queued state in the execution queue in which the job currently resides. If a job is marked as not rerunable then the rerun request will fail for that job. If the mini-server running the job is down, or the rejects the request, the Rerun Job batch request will return a failure unless -f is used. Using -f violates IEEE Batch Processing Services Std and should be handled with great care. It should only be used under exceptional cir- cumstances. Best practice is to fix the problem mini-server host and letting qrerun run normally. The previous nodes may need manual cleaning. See the -r option on the qsub and qalter commands. OPERANDS
The qrerun command accepts one or more job_identifier operands of the form: sequence_number[.server_name][@server] STANDARD ERROR
The qrerun command will write a diagnostic message to standard error for each error occurrence. EXIT STATUS
Upon successful processing of all the operands presented to the qrerun command, the exit status will be a value of zero. If the qrerun command fails to process any operand, the command exits with a value greater than zero. SEE ALSO
qsub(1B), qalter(1B), pbs_alterjob(3B), pbs_rerunjob(3B) Local qrerun(1B)
All times are GMT -4. The time now is 10:32 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy