Selective input passing, for cron with multiple interval


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Selective input passing, for cron with multiple interval
# 1  
Old 11-11-2009
Selective input passing, for cron with multiple interval

0,0 4,5 11 11 * /pkgs/roots/scripts/job_monitor.ksh

i have the requirement like,
for the first time(4) the script should have the input parameter as "Value1"
but the second time(5) it should have the input parameter as "Value2"

Can we achieve this using any cron options ? If yes, How..??

Otherwise what is the best approach to achieve this within the script ?
# 2  
Old 11-11-2009
-- you cannot do with cron options.

-- check the current time in script, and use argument appropriately.
# 3  
Old 11-11-2009
agree, split to two cronjobs will be easy solution.

Code:
0 4 11 11 * /pkgs/roots/scripts/job_monitor.ksh var1
0 5 11 11 * /pkgs/roots/scripts/job_monitor.ksh var2

otherwise, you have to write one more if-then-else-fi in your ksh script.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Multiple selective keyword Report

Dear All, I have a question on what is the best way to control and list out multiple selective keywords to print out the report Below is the Sample output of the listing Code1 Code1 Code1 Identifier "Job" Code2 Code2 Code2 Name "Impressive" Code3 Code3 Code3 AGT_Manual Code1... (3 Replies)
Discussion started by: ckwan
3 Replies

2. UNIX for Dummies Questions & Answers

Passing Input To Function

May i please know why is it printing the script name for $0 when i pass those parameters to function. #!/bin/bash -x usage() { echo "In Usage Function" echo $0 echo $1 echo $2 } echo "printing first time" echo $0 echo $1 echo $2 usage $0 $1 $2 Output: (2 Replies)
Discussion started by: Ariean
2 Replies

3. Shell Programming and Scripting

Passing variables to an input file

Hi All, I have to insert 2 values to a text file in specific places. I have been able to extract each variable value via a script but am not able to send these variable values to the text file. Pasted is the script for extracting the variable values: for i in `ls -1` ... (2 Replies)
Discussion started by: danish0909
2 Replies

4. Shell Programming and Scripting

Passing a variable as input to another shell

I have a shell program that calls another shell program the following code works . chkTimeFormat.sh "10/9/12 17:51:19:783."|read c but when I am passing the the time in a variable like in the code below, the shell chkTimeFormat.sh is not returning proper value time="10/9/12... (9 Replies)
Discussion started by: swayam123
9 Replies

5. Shell Programming and Scripting

get selective input and run cron job.

Hi, I have one shell script where it will copy all files to a directory which is already present, For example : i have directory DIRA and DIRB, and my shell script will expects user input to specify which directory should files must be copied. this shell scrip i am running every day using... (1 Reply)
Discussion started by: asak
1 Replies

6. Shell Programming and Scripting

Multiple Interval cron issue with order of execution

55,0 5,6 * * * myScript This cron task will execute on 5:00AM, 5:55AM, 6:00AM and 6:55AM. Is there any possibility to make it run only in the order specified such as 5:55AM and 6:00AM (basically only on the 2 intervals) ? (1 Reply)
Discussion started by: vikram3.r
1 Replies

7. Shell Programming and Scripting

How to run a ksh in bg after passing input

Hello, I've got a KSH which I use to monitor processes then email me when complete. I pass the process name to the script and the update interval. Does anyone know how I can get this to execute in the background. I can't use 'scriptname &' as it starts in the background before reading in my... (3 Replies)
Discussion started by: Grueben
3 Replies

8. UNIX for Dummies Questions & Answers

Passing Shell Input to AWK

I am trying to search a log for a particluar pattern listing the total # of occurences in the end. I thought using a shell script for input then calling awk to search for the paramters specified. I want the script to be usable acorss envs. Code: #! /usr/bin/bash # get the variables... (5 Replies)
Discussion started by: wawa44oz
5 Replies

9. Shell Programming and Scripting

Passing input to perl command

Hi, In awk in can pass input to a command like this echo "1 2" | awk '{p=$1+$2;print v}'or I can use v option to pass input to awk command In the similar way How can I pass input to a perl command. For example : perl -pi -e 'if ( $. == 2 ) {print "Hello\n" }' input.txtIn the above... (1 Reply)
Discussion started by: john_noble
1 Replies

10. Shell Programming and Scripting

Cron job for wekkly interval

Hi, I would like to trigger a scipt on every Wednesday 12:00PM. how can schedule this script in CRON command. Could you please help me on this. (3 Replies)
Discussion started by: koti_rama
3 Replies
Login or Register to Ask a Question