cancel
Showing results for 
Search instead for 
Did you mean: 

Script Control

Trenta Angelo
Contributor

Script Control

Hi all

I wrote a script, and I'd like someone to suggest me if it's right, if there are problems.
in attachement there is also the requirements.

Regards, Angelo



Overview of the ERS use of files:

When the variable XSM_ER_WRITE_EVENTS_TO_FILE is set to 1, the event router will maintain its processing information within the directory $XSM_TMP/ER. This processing information can be used to find a stale GUI registration. If XSM_ER_WRITE_TO_FILE is set to 0, there will not be enough information in the $XSM_TMP/ER directory to identify a stale registration. The following files that can be found within directory $XSM_TMP/ER are used by the event router:

events/e## -- These directories hold the event files.
registrations/pcNameOrIP.PID -- These files contain the DCE object name and the GUI registration infomation. The first line is the DCE object name and the second line to the last list are the registration strings.
events_sent/pcNameOrIP.PID -- These files contain the last event number that was successfully sent to the GUI.

Identifying a stale GUI registration

Note: The check for stale registrations needs to ignore the UNIX server processes.

The post time for the oldest event is timestamp on the oldest file in the events directory. If this file is over 20 minutes old, there is a back log of events. The UNIX command for printing this timestamp is:
ls -ltr $XSM_TMP/ER/events/e*/* | awk 'NR == 1 {print $8}'

The GUIs causing the backlog are all the GUIs with files in the events_sent directory:
that have a length of 0 (i.e. no events were sent to that PC) or
where the contents of the file refer to an event file that does not exist. i.e. if the file
$XSM_TMP/ER/events/e*/$(cat $XSM_TMP/ER/events_sent/pcNameOrIP.PID)
exists then the GUI registration is active. Otherwise the GUI registration is stale.

The surest way to remove the stale GUI registration is to:

Identify the events_sent and registration files for the stale GUI registrations
Stop the event router
Remove the identified events_sent and registration files
Start the event router


I will work harder, HP-UX is always right
3 REPLIES
Klaus Crusius
Trusted Contributor

Re: Script Control

Hi,

not very nice to burden our community with your day to day job. I hope you are paid for it.
The script is lacking everything which makes it understandable without unnecessary deep involvement. Please write comments before every paragraph of your script.

Klaus
There is a live before death!
harry d brown jr
Honored Contributor

Re: Script Control

Trenta,

As Klaus said, you need to add a lot of comments to your script.

And you need to add a lot of ERROR checking. You are performing "rm"'s and "cd"'s without any error checking, which is very very dangerous.

I'd also suggest putting "echo" in front of the commands like "rm", just to make sure they are going to perform the way you want it to. Also, use "set -x" to "trace" the script!

live free or die
harry
Live Free or Die
Mark Greene_1
Honored Contributor

Re: Script Control

read this:

http://www.nd.edu/~arodrig6/tao/

HTH
mark
the future will be a lot like now, only later