Sponsored Content
Top Forums UNIX for Dummies Questions & Answers Check time and Increase counter Post 302376506 by abilash.amara on Tuesday 1st of December 2009 01:49:43 PM
Old 12-01-2009
Reply

I dont know how to extract string from the line mentioned. Could you tell me how to do it. so that i could store it in variable eg

VAR1 = Epochtime
VAR2 = Count.

Also i dont know how to replace the count in the line after it had been increased by 1.

The first set of numbers u see is the epoch time of the time that line is created.

I was thinking of running something like

Code:
LC = line Count of file
While ( LC > 1)
      do
       Read  line
           Var1= Epochtime, Var2 = CountValue,
           If [ (CurrentSystemTime - Var1 ) >= 900 ]
                   Var2 = Var2 ++
                   Insert Var2 back into the line replacing the old value
             LC = LC --
           else
             LC = LC --
      done
LC = Line Count of file
While ( LC > 1)
       do
        Read Line
           Var2 = Count value
           If [ mod(var2/5) == 0 ]
               Send line to another file or send email alert to abc.def@xxx.com containg the To and From addess
               LC = LC --
           Else
               LC = LC --
        done

This is a rough idea of how i imagine the logic to be . The pboblem I face is how to extract the values to a variable and how to insert back to the respective line and continue on for each line of the file. This is primitive any optimizing will be helpful.

Epoch time is the representation of time in seconds by the linux system.
 

9 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

increase the logout time

respected sirs, how to increase the logout time in unix...... at present when we r idle for 5 min...... the system is responding with login again.......and the other problem how to add an operator ........plz help to solve my queries thanking u sir ... (1 Reply)
Discussion started by: manikumar
1 Replies

2. UNIX for Advanced & Expert Users

Increase the counter in UNIX

HI! All Iam facing an issue with split comman in unix Prifix=Z_PRICE_NEW`date "+%Y%m%d%H%M%S"` split -5000 Product.txt $Prifix find . -name "$Prifix*" -print | { while read FILE; do mv $FILE $FILE.txt done } when is execute the comman the command is working fine and generating the... (2 Replies)
Discussion started by: mohdtausifsh
2 Replies

3. Shell Programming and Scripting

Check Time/Date on a server

I have two servers which are not in sync. I need to write a script that checks the time on the corresponding server and another script to call the above script on both the servers simulataneously to check if there is a time difference. Can anyone provide me with such scripts as I am new to... (3 Replies)
Discussion started by: ravneet123
3 Replies

4. Shell Programming and Scripting

Check data and time

I am attempting to figure out how to do a time check within my script. For some reason I can not seem to get this to work correctly. I want the script to first see if it is Saturday. If it is Saturday then check to see if it's between the time 5:30am and 6:30am. If it is between 5:30am and... (4 Replies)
Discussion started by: LRoberts
4 Replies

5. UNIX for Dummies Questions & Answers

Time check!

How can i do something, that will be doing periodicaly for 24 hours and then do something else. For example: i want to write "time" in a text file every 10 sec but only for the next 24 h and then rewrite all that data to an other file, then again write "time" in the first file every 10 sec,... (5 Replies)
Discussion started by: petel1
5 Replies

6. Shell Programming and Scripting

Check file time stamp

Hi, I need help to read file in a directory on basis of time stamp. e.g. If file access in last 2 minutes it should not be copy to remote directory. Below is my script. #!/bin/ksh DATE=`date +"%Y-%m-%d_%H%M"` SEPARATER=" " exec < out_interfaces.cfg while read source_path... (10 Replies)
Discussion started by: qamar.alam
10 Replies

7. Solaris

Solaris 10- DHCP lease time increase

HI Admins, can anyone tell me how can I increase the lease time in Solaris 10. I want to use that dhcp address for 4 weeks. (2 Replies)
Discussion started by: snchaudhari2
2 Replies

8. Shell Programming and Scripting

IF loop to check the time modified

Hi Frnds, i have a folder test in which files generated daily how to chek the files that are modified on that day as a condition for ex, if then echo "i have got something to do with the file" else echo" sorry" fi i will have more than 3 to 4 files that are modified today. and if... (5 Replies)
Discussion started by: mahesh300182
5 Replies

9. Shell Programming and Scripting

Check if time format is valid

How can I validate if time (HH:MM:SS) argument is valid? I got this from web but I can't modify it to exit the script if the time argument is invalid. echo $1 | awk -F ':' '{ print ($1 <= 23 && $2 <= 59 && $3 <= 59) ? "good" : "bad" }' ex: ./script.ksh 12:34:21 = okay ./script.ksh... (10 Replies)
Discussion started by: erin00
10 Replies
PACEMAKER(8)						  System Administration Utilities					      PACEMAKER(8)

NAME
Pacemaker - Part of the Pacemaker cluster resource manager SYNOPSIS
crm_verify [modifiers] data_source DESCRIPTION
crm_verify - Check a (complete) confiuration for syntax and common conceptual errors. Checks the well-formedness of an XML configuration, its conformance to the configured DTD/schema and for the presence of common misconfigu- rations. It reports two classes of problems, errors and warnings. Errors must be fixed before the cluster will work properly. However, it is left up to the administrator to decide if the warnings should also be fixed. OPTIONS
-?, --help This text -$, --version Version information -V, --verbose Increase debug output Data sources: -L, --live-check Check the configuration used by the running cluster -x, --xml-file=value Check the configuration in the named file -X, --xml-text=value Check the configuration in the supplied string -p, --xml-pipe Check the configuration piped in via stdin Additional Options: -S, --save-xml=value Save the verified XML to the named file. Most useful with -L EXAMPLES
Check the consistency of the configuration in the running cluster: # crm_verify --live-check Check the consistency of the configuration in a given file and produce verbose output: # crm_verify --xml-file file.xml --verbose AUTHOR
Written by Andrew Beekhof REPORTING BUGS
Report bugs to pacemaker@oss.clusterlabs.org Pacemaker 1.1.7 April 2012 PACEMAKER(8)
All times are GMT -4. The time now is 06:37 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy