Sponsored Content
Full Discussion: event number tracking
Top Forums Shell Programming and Scripting event number tracking Post 95204 by frustrated1 on Monday 9th of January 2006 04:16:15 AM
Old 01-09-2006
event number tracking

Having a bit of trouble trying to sort this one out so any advice is appreciated.
I have several scripts running in cron monitoring different events on different servers. These scripts log information events and critical events to a central log file.

I wanted to add an event number to every logged event in the file so I have a file with a number in it to start - say 000000

Then in every script I have the following when I log any event:
curevent=`tail -1 /logs/eventnums | cut -f1 -d" "`
eventnum=$(($curevent + 1))
echo "$eventnum event info" >>/logs/central_events.log
echo $eventnum > /logs/eventnums

/logs/eventnums is where I keep the latest event number and its updated by the cron scripts everytime they take a number...
Problem is that some of the scripts have to run at the same time in cron and so eventually they take the same eventnum each and update the eventnums file at the same time so I end up with events with the same number which is no good..

Any suggestions on a better way to do this?
 

3 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

Command Tracking

Hi, OS: Solaris9, SPARC Is there any way I can track the commands run by users from the shell prompt? Example: Somebody is deleting files from the system. Who it is is a mystery. That person obviously does not use bash prompt so there is no history. Is there anyway I can find out who... (5 Replies)
Discussion started by: mahatma
5 Replies

2. UNIX for Advanced & Expert Users

Tracking down the problem

Is there a way to track down what process is sending to a certain port? I have some thing pounding the network with requests to a multicast IP that doesn't exist. I have shut down all comms related processes and yet it is still there. Need a way to track the port or IP back to the process. Thanks... (3 Replies)
Discussion started by: mattmanuel
3 Replies

3. Programming

Methods for Random Number Tracking

what types of methods and algorithms are used to track random number generators? I'm working on computer security, and I want to know all the different ways to track random number generators so I know what to counter (8 Replies)
Discussion started by: azar.zorn
8 Replies
update(n)						       Tcl Built-In Commands							 update(n)

__________________________________________________________________________________________________________________________________________________

NAME
update - Process pending events and idle callbacks SYNOPSIS
update ?idletasks? _________________________________________________________________ DESCRIPTION
This command is used to bring the application "up to date" by entering the event loop repeatedly until all pending events (including idle callbacks) have been processed. If the idletasks keyword is specified as an argument to the command, then no new events or errors are processed; only idle callbacks are invoked. This causes operations that are normally deferred, such as display updates and window layout calculations, to be performed imme- diately. The update idletasks command is useful in scripts where changes have been made to the application's state and you want those changes to appear on the display immediately, rather than waiting for the script to complete. Most display updates are performed as idle callbacks, so update idletasks will cause them to run. However, there are some kinds of updates that only happen in response to events, such as those triggered by window size changes; these updates will not occur in update idletasks. The update command with no options is useful in scripts where you are performing a long-running computation but you still want the applica- tion to respond to events such as user interactions; if you occasionally call update then user input will be processed during the next call to update. EXAMPLE
Run computations for about a second and then finish: set x 1000 set done 0 after 1000 set done 1 while {!$done} { # A very silly example! set x [expr {log($x) ** 2.8}] # Test to see if our time-limit has been hit. This would # also give a chance for serving network sockets and, if # the Tk package is loaded, updating a user interface. update } SEE ALSO
after(n), interp(n) KEYWORDS
event, flush, handler, idle, update Tcl 7.5 update(n)
All times are GMT -4. The time now is 12:42 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy