Running the calling script/task as per day


Login or Register for Dates, Times and to Reply

 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Running the calling script/task as per day
# 1  
Running the calling script/task as per day

Hello all..
i have few task to do on specific day ar per weekday or weekend...
for example i have 3 tasks:
Code:
task1
task2
task3

Now i need to create a shell script
If it is weekday it will change the status of these tasks as below
Code:
sendevent -E CHANGE_STATUS -s SUCCESS -J task1
sendevent -E CHANGE_STATUS -s SUCCESS -J task2
sendevent -E CHANGE_STATUS -s SUCCESS -J task3

and if it is weekend the task1,task2 and task3 should simply run


Moderator's Comments:
Mod Comment Please use code tags


---------- Post updated at 04:49 PM ---------- Previous update was at 03:52 PM ----------

ok..sure i will use the tags..

---------- Post updated at 04:50 PM ---------- Previous update was at 04:49 PM ----------

can anybody suggest what can be done...

Last edited by vbe; 10-24-2011 at 10:15 AM.. Reason: code tags, see PM - VBE : Typos spelling
# 2  
Perhaps we need to know a little more...
a) Why "for example"?

b) What are these tasks ( or what do you call task)? Processes, programs? jobs?

c) You know our policy is more strict on what we expect from people posting in shell/programming... We expect to see something you started showing us you tried to do it, but cannot...

d) what does:
Code:
sendevent -E CHANGE_STATUS -s SUCCESS -J task1

?

So that we understand the difference between week and week-end

Only once all this is clear can we help you
# 3  
man crontab first

For example, you need run the scrip on weekday and have one hour gap between three tasks.

Code:
0 10 * * 1,2,3,4,5 sendevent -E CHANGE_STATUS -s SUCCESS -J task1
0 11 * * 1,2,3,4,5 sendevent -E CHANGE_STATUS -s SUCCESS -J task2
0 12 * * 1,2,3,4,5 sendevent -E CHANGE_STATUS -s SUCCESS -J task3

run on weekend
Code:
0 10 * * 6,7 task1;task2;task3

# 4  
its in cron...
# 5  
I might be wrong and sorry if am.

It looks like the current thread is similar to this thread - https://www.unix.com/shell-programmin...dule-jobs.html
Login or Register for Dates, Times and to Reply

Previous Thread | Next Thread
Thread Tools Search this Thread
Search this Thread:
Advanced Search

Test Your Knowledge in Computers #417
Difficulty: Medium
The terms Vanilla JavaScript and Vanilla JS refer to JavaScript which uses very small cookies during web sessions.
True or False?

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

How to avoid running duplicated task?

Hi Gurus, I have requirement to run different task based on input value. the sample file as below: file1 (contains code need to be run) code aaa1 aaa2 bbb ccc ddd file2 (contains all codes and job name) code job1 job2 aaa1, job_aa1, job_a2 aaa2, job_aa2, job_a2 aaa3,... (5 Replies)
Discussion started by: ken6503
5 Replies

2. Shell Programming and Scripting

Root running a script calling to scp using user "xyz" is not authenticating!

Close duplicate thread. (0 Replies)
Discussion started by: denissi
0 Replies

3. UNIX for Dummies Questions & Answers

Running Script via Crontab on 2nd Working day each month

Hello Guys, I have a questions regarding running a shell script every second working day each month. I have no clue how solve this problem :wall:. Important is that it has to be the second working (Mo-Fr). Example: If 1st and 2nd Days of month are Sat and Sun the script must run on 4th day... (5 Replies)
Discussion started by: Hollo
5 Replies

4. Shell Programming and Scripting

Need help in running script on last day of month

Hello Experts/Guru, I need a help in running the script on every month last day.... PS: due to some constrain I can't schedule in crontab Requirement: On Jan 31st i want to run some script, similarly on Feb 28th, March 31st, April 30th......till Dec 31st. Please help me by providing... (3 Replies)
Discussion started by: aks_1902
3 Replies

5. 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

6. Shell Programming and Scripting

running a script only till a point in a day

how can i run the script if its less than a particular time only in unix. for e.g the script kicks off at 9AM and looks for some file etc. I want to make sure it runs only till 12PM and then succeed the job and proceed regardless if the file exists or not. how can we do this (1 Reply)
Discussion started by: dsravan
1 Replies

7. Shell Programming and Scripting

Running a unix script(which is calling another script inside that) in background

Hi all, I am having a script ScriptA which is calling a script ScriptB in the same server and copying files to second server and have to execute one script ScriptC in the second server. THis First script ScriptA is the main script and i have to execute this process continously. for Keeping... (2 Replies)
Discussion started by: rohithji
2 Replies

8. 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

9. Shell Programming and Scripting

killing and relaunching a task every 15 minutes while a script is running

Hi there, I would like to write a script which while running will kill and then execute again a task every 15 minutes. Here's what I want to do: Al Jazeera English have a low quality, time-limited 15 minute trial stream up at their site. I.e. when I click on the 56K link, it will play in... (0 Replies)
Discussion started by: ropers
0 Replies

10. 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

Featured Tech Videos