Checking the file depending on the input variable


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Checking the file depending on the input variable
# 1  
Old 09-11-2014
Wrench Checking the file depending on the input variable

Hi

I have a requirement of taking time as input variable outside the script.depending on the time it will check the file output .like

Code:
./script.sh <30 min>

so script.sh should run every 5 minutes ie.6 times to check the output file.Can any one please help here.
# 2  
Old 09-11-2014
Hi,

What do you already have?

Regards

Dave
# 3  
Old 09-11-2014
Hi,

This is how i have started.to get the input variable as time

Code:
#!/bin/ksh
# set -xv
echo ' '

if [[ $1 = '' ]]
then
    read -r time?"Enter the kick time ==> "
else
    time=$1
fi

Now have to write for the calculation.if time is 30 minute then every 5 minutes need to check the output file.i.e 6 times.
# 4  
Old 09-11-2014
Hi,

Will the time be entered in minutes all the time, or will it be a mixture of hour minutes?

Regards

Dave
# 5  
Old 09-11-2014
Hi

yes it will be in minute.i.e 30 minute
# 6  
Old 09-11-2014
Hi,

Does your system have "watch" on it;

Code:
man watch

or
Code:
whence watch

should tell you.

This will allow you to run a shell script a set number of times, the interval can be defined several ways.

Regards

Dave
# 7  
Old 09-11-2014
yes, my system has watch in it.
Can you please give one example with the same objective using watch.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Can't input large file to variable

I have a file that I'm trying to place into a variable. I've tried the following: DATE=`date +%Y%m%d` filez=$(cat /tmp/Test_$DATE.txt)DATE=`date +%Y%m%d` filez=$(</tmp/Test_$DATE.txt)DATE=`date +%Y%m%d` filez=$(`cat /tmp/Test_$DATE.txt`)None of these lines allows the file to go into the... (3 Replies)
Discussion started by: newbie2010
3 Replies

2. Shell Programming and Scripting

Split a non delimited file into columns depending on user input

I would like some advice on some code. I want to write a small script that will take an input file of this format 111222233334444555666661112222AAAA 2222333445556612323244455445454545 2334556345643534505435345353453453 (and so on) It will be called as : script inputfile X (where X is... (5 Replies)
Discussion started by: onlyforbopi
5 Replies

3. Shell Programming and Scripting

XML variable for input in same input file

Dear All , i stuck in one problem executing xml .. i have input xml as <COMMAND name="ARRANGEMENT.WRITE" timestamp="0" so="initial"> <SVLOBJECT> <LONG name="CSP_PMNT_ID" val="-1"/> <MONEY name="CSP_CEILING" amount="0.0" currency="AUD"/> ... (6 Replies)
Discussion started by: arvindng
6 Replies

4. Shell Programming and Scripting

checking users input to file

ok im sorta stuck on this, The user enters a car model and it has to check it in a text file in the current directory. If the car model is not in the file, user has to enter another model This is what i have so far read -p "Enter a car model: " car1 grep -w $car1=$(cat carMakes.txt)... (3 Replies)
Discussion started by: gangsta
3 Replies

5. Shell Programming and Scripting

Reading from a File and Using as an Input variable

I need to know how the the string constant from Input File should be read and provide as input data for the script . INPUT FILE CONST VARIABLE myname=/root/dir/syslog/myname1 myname=/root/dir/syslog/myname2 myname=/root/dir/syslog/myname3 urname=/root/dir/syslog/urname1... (6 Replies)
Discussion started by: baraghun
6 Replies

6. Shell Programming and Scripting

How to write shell script for input file name format checking?

Hello, I had written a shell script that accepts input file as cmd line argument and process this file. if ; then if ; then . $1 LOGFILE="$LOG_FILE/MIG_BIOS.log"; get_input_file else ERROR_CODE=MSCRM0005_003 error "$ERROR_CODE : Input file $1 is not available"; exit... (3 Replies)
Discussion started by: Poonamol
3 Replies

7. Shell Programming and Scripting

How to change variable name depending on iteration

Hi, I would like to get a solution to this situation if possible. In a "for" loop how can I assign a value to a variable and then change the name of that variable depending on the loop iteration? So what I am looking for is something like this in pseudo-code: for i in 1 2 3 4 do echo... (2 Replies)
Discussion started by: yonderboy
2 Replies

8. Shell Programming and Scripting

Insert text into file depending on variable

Hey guys , i have a variable with the contents ... NUMBER=4 and a test file with the contents 1248 1213 1214 1278 1200 3045 3444 2130 I want to execute a script that will produce the following output ( based on NUMBER=4) to be ... create 1248 (1 Reply)
Discussion started by: theshams
1 Replies

9. Shell Programming and Scripting

Checking if file exists using a NOT operator and shell variable

Hi, I'm new to UNIX, at least shell programming and am having trouble figuring out a problem i'm having. In one section in my nested if statement, i want the program to test if the file does not exist, based on an argument supplied at the command line by the user. What i have is elif ; then... (3 Replies)
Discussion started by: rowlf
3 Replies

10. Shell Programming and Scripting

How to get variable input from a file

Hi guys, I want to input some variables from a file. I tried it with following script, for i in 1 2 3 4 do read varible1 varible2 < ddd.txt echo $varible1 $varible2 done ... (1 Reply)
Discussion started by: maheshsri
1 Replies
Login or Register to Ask a Question