Time Manipulation in shell script


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Time Manipulation in shell script
# 1  
Old 08-25-2009
Question Time Manipulation in shell script

Hi all,

I have a script that requires time comparisons and sending out an email alert only if the specified interval has been completed. The script runs in Cron tab every 5 mins.

For ex: If the interval is set to 2 hrs (Dynamic & varies )
My script should execute and if it finds any error conditions during the execution, It will page an alert. In the next cycle if the script finds the same error, It should not page error mail again. ie., It should page only after the above mentioned 2 hrs.

I used GAWK-Strftime function to achieve this. But later came to know the package has restrictions and should not be used in my server.

Is there a way this can be achieved with any of the Solaris inbuilt utilities or functions ?

Please help !!
# 2  
Old 08-25-2009
The search box is your friend :-)

these sort of questions arise frequently.

you may find something useful in the FAQ article:

https://www.unix.com/answers-frequent...rithmetic.html

Specifically for you I think:

https://www.unix.com/tips-tutorials/3...tion-bash.html
or
https://www.unix.com/shell-programmin...pulations.html

may be useful.

HTH
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Capture run time of python script executed inside shell script

I have bash shell script which is internally calling python script.I would like to know how long python is taking to execute.I am not allowed to do changes in python script.Please note i need to know execution time of python script which is getting executed inside shell .I need to store execution... (2 Replies)
Discussion started by: Adfire
2 Replies

2. Shell Programming and Scripting

Shell script to convert epoch time to real time

Dear experts, I have an epoch time input file such as : - 1302451209564 1302483698948 1302485231072 1302490805383 1302519244700 1302492787481 1302505299145 1302506557022 1302532112140 1302501033105 1302511536485 1302512669550 I need the epoch time above to be converted into real... (4 Replies)
Discussion started by: aismann
4 Replies

3. Shell Programming and Scripting

Shell script text file manipulation.

Hello, I have mysql binary file which logs all the database queries and i to insert all queries log in to database. First i coverted binary file to text file. and start playing with it. Text file contains following queries, some samples are, SET INSERT_ID=1; INSERT INTO test... (0 Replies)
Discussion started by: mirfan
0 Replies

4. Shell Programming and Scripting

sed string manipulation in shell script

Hello, I have 1000 of sql queries and i need to push column value in query. e.g. SET INSERT_ID=1 INSERT INTO test (id,name) VALUES ('a'); SET INSERT_ID=2 INSERT INTO test (id,name) VALUES ('b'); SET INSERT_ID=3 INSERT INTO test (id,name) VALUES ('c'); SET INSERT_ID=4 INSERT INTO test... (12 Replies)
Discussion started by: mirfan
12 Replies

5. Shell Programming and Scripting

Get the time with shell script

when I get time some times it like $hwclock -r Mon 07 Jul 2008 20:01:48 PM GMT -0.486264 seconds some times it like $hwclock -r Mon Jul 7 20:01:48 2008 -0.547393 seconds the sequence is not the same all the time and I just want to use "hwclock" not "date" to get time I... (8 Replies)
Discussion started by: yanglei_fage
8 Replies

6. Shell Programming and Scripting

Files manipulation with time comparison

Hi guys - I am new to Unix and learning some basics. I have to create a report of files that are in a specific directory and I have to list filenames with specific titles. This report will be created everyday early in the morning, say at 05:00 AM. (see output file format below) The 2 categories... (2 Replies)
Discussion started by: sksahu
2 Replies

7. Shell Programming and Scripting

Pattern manipulation in korn shell script using sed.

Hi, Could any one let me know, how can I cut the last field in below mentioned line. net,-hopcount,0,-netmask,255.255.255.0,,,,,192.168.37.0,10.253.0.1 net,-hopcount,0,-netmask,255.255.255.0,,,,,192.168.1.0,10.253.0.1 net,-hopcount,0,-netmask,255.255.255.0,,,,,192.168.38.0,10.253.0.1... (3 Replies)
Discussion started by: ajilesh
3 Replies

8. Shell Programming and Scripting

need help in time manipulation

i have a script that gives the last time the data is inserted in a file. i want to check the time difference b/w the sytem time and the time in file. for e,g. if script runs at 3.30.So $a=3.30 and the time in file is 3.00.So $time =3.00 then the time difference should be 30 min...... ... (6 Replies)
Discussion started by: ali560045
6 Replies

9. Shell Programming and Scripting

shell script : text manipulation (easy quesiton)

hi, i am newbie in shell script i want to do the following: given a filename like abc.txt i want to change the name to abc.properties how to do it? pls enligthen me. thanks (3 Replies)
Discussion started by: champion
3 Replies

10. Programming

Time/date manipulation

hey folks, been awhile (actaully a long while) since i last touched C. And the 3 books i've read don't really have much about using time.h Question: How would i be able to assign a variable the value of the current date minus 2 mths, keeping in mind the yr. IE. would like to see Nov.31/2001... (1 Reply)
Discussion started by: choice
1 Replies
Login or Register to Ask a Question