Sponsored Content
Top Forums Shell Programming and Scripting My Script For Process Checking is NOT Working Post 302628957 by methyl on Tuesday 24th of April 2012 07:32:07 AM
Old 04-24-2012
Assuming that the script containing the duplicate session test is called
IP-PoolSession-Summary.sh then surely one copy running is not a problem ($psef -eq 1). The second and subsequent copies are a problem ($psef -ge 2). Don't forget to count the script you are running the test from!

Code:
psef=`ps -ef | grep "IP-PoolSession-Summary.sh" | grep -v "grep" | wc -l`
if [ $psef -ge 2 ]

I too recommend using flag files. The output from ps is not reliable enough for this type of processing.

Last edited by methyl; 04-24-2012 at 08:41 AM..
 

10 More Discussions You Might Find Interesting

1. HP-UX

checking process existed

On HP-UX, in application, if the process id has been get with the getpid() and sotred in database, then other monitor process want to check it if the process is existed, are there any system function can do it? I do not want to use the shell script, because it should use popen function to excuted... (5 Replies)
Discussion started by: Frank2004
5 Replies

2. Shell Programming and Scripting

Checking the cron process in unix

Hi Experts, Is there any command by which i can chk that the cron process is running fine? Say i have scheduled the cron to run at 10 o clock every monday,Do i need to wait for the time it runs and then chk using ps -ef? Please shed some light. Thanks Ashok. (2 Replies)
Discussion started by: Ashok_oct22
2 Replies

3. Shell Programming and Scripting

Checking for multiple instances of a process

Hi I have a scenario where i need to check multiple instances of a running shell script (abc.sh) . How can I find from inside a running shell script whether any other instance of the same script is running or not? If any other instance of same shell script is running I need to exit from... (4 Replies)
Discussion started by: raghu.amilineni
4 Replies

4. Shell Programming and Scripting

The checking of folder existance is not working...

Hi all, I have the following code: if ; then echo 'folder not exist'; else echo 'folder exist'; fi The "testing" folder is not exist in /home/batch , but thhe result is 'folder exist'. It seems that the code cannot detect that the folder "testing" not exist. ANybody know the... (1 Reply)
Discussion started by: suigion
1 Replies

5. Shell Programming and Scripting

Process checking loop

Hi, I want to create a script who will check if the java process is running & if it finds the process is still there it continues to execute & when the process completes it exit from the script. I have written a code to check & notify the process existence but i am not getting how to write... (4 Replies)
Discussion started by: d8011
4 Replies

6. Shell Programming and Scripting

block process checking

How can i check block process in Linux? If found any what action is required? How to check the pid of process? How to kill the block process? How to find out bottleneck process? (3 Replies)
Discussion started by: learnbash
3 Replies

7. AIX

Script Checking LVM Mirror not Working

Hi, I need to know who can I create an script in order to check server mirror in AIX. I got this script !/usr/bin/ksh # # Check if a VG is mirrored. # # lsattr -El <lvname> -a strictness -a copies # If copies=2 and scrictness=y, then VG is mirrored # # LVs are retrieved via 'lsvg -l... (5 Replies)
Discussion started by: fede_mont
5 Replies

8. Solaris

Python script not working in batch process

Good morning, I have a python 2.3 script that runs stand alone as intended when tested, then it was put into a ksh script. when running the ksh script it runs as intended. The problem is that my script does not run when the ksh script is called by another user who runs a batch process (as of right... (1 Reply)
Discussion started by: mhahe
1 Replies

9. Shell Programming and Scripting

Problem with a script for checking the state of a process

Hello Everyone, I have a process that should be always running. Unfortunately, this process is getting down almost every 10 minutes. I want to make a script that verify the state of this process: If the process is up, the script shouldn't do nothing and if it's down he should run it. Can... (3 Replies)
Discussion started by: adilyos
3 Replies

10. Shell Programming and Scripting

Checking DataPump Process

Hi All, I am writing script for Env refresh for Oracle DB. I am using Datapump for that. If i start expdp or impdp, how can i know that export or import has completed. I have query for that. How will i integrate with script?. Or any command i can run from Linux side. Please share you... (1 Reply)
Discussion started by: pvmanikandan
1 Replies
CHANGETRACK(1)						      General Commands Manual						    CHANGETRACK(1)

NAME
changetrack - track changes to files SYNOPSIS
changetrack [-h] [-c configfile] [-d directory] [-e] [-r] [-q] [-m message] [-M message] [-v] [-u] [-o toaddress] [-f fromaddress] DESCRIPTION
changetrack is a program to monitor changes to a bunch of files. If files are modified one day, and the machine starts working incorrectly some days later, changetrack can provide information on which files were modified, and help locate the problem. Normally changetrack uses ed to keep track of various revisions of the files by maintaining an .ed script with the change history for each file. Alternatively, changetrack can use rcs to keep track of various revisions of the files. Each file is "installed" in the rcs system the first time that changetrack is run after that file is added to the config file. Whenever changetrack is run after that, a copy of the file is made, which is 'checked in' and implicitly 'checked out' of the rcs system. See the man page of co for information on retrieving an old version of the file. Backup files (ending in tilde ~) are ignored, unless explicitely included. After each pattern in the file list, adding white space, a colon (:) then more whitespace, followed by email addresses, separated by more whitespace, will result in the changes to that file being emailed to that address. All changes from each run are expressed in one email. Using the email feature requires Mail::SendMail to be installed; if it does not work correctly, an error message will be printed to stan- dard error. OPTIONS
-h Display a short help message then exit. -cconfigfile Get the list of files to track from configfile instead of from ~/.changetrackrc (/etc/changetrack.conf for the super-user) -doutputdirectory Store output in outputdirectory instead of in ~/.changetrack/ (/var/lib/changetrack/ for the super-user) -e Keep a copy of the file from when it was first added to the changetrack configuration, and keep ed -styled changes to rebuild the file. This option is recommended only if rcs does not work on the machine. To recover using this means, the .ed file should have the last several commands removed, to allow the file to be rebuilt to the appropriate state. A command like 'cat myfile.ed | ed myfile.original' should be executed. -r Disable the rcs facility. -q Quiet mode; only print critical messages. Good for scripts. -mmessage Print message on each file, after checking for any changes. Good for indicating reboots or other system events. -Mmessage Like -m, but message is only printed on modified files. -v Print version and exit. -u Use unified diffs (this only works with some implementations of diff. -oemailaddress Mail output to emailaddress. This is supplementary to emails specified in the config file. -femailaddress Set "From" header to emailaddress, which must be fully qualified. REQUIREMENTS
This program requires diff. Unless the -r switch is used, this program requires rcs to be installed. If the -e switch is used, ed is required. FILES
~/.changetrackrc List of files to monitor. Each line may start with '#' indicating a comment. If a line is not a comment, it contains a file/pattern to monitor, and optionally " : " followed by any email addresses to send changes to. The filename may be a pattern described in the same way as for ls. Note: the default is /etc/changetrack.conf for root. ~/.changetrack/ Default directory in which to store output information. The default is /var/lib/changetrack/ for root. All rcs files are stored in this directory, unless a subdirectory called RCS exists, in which case the rcs files are stored in that directory. /etc/cron.daily/changetrack Script that creates the list of all files monitor. /etc/cron.hourly/changetrack Script that invocates changetrack. /etc/default/changetrack Configuration for the above two scripts. DIAGNOSTICS
Each filename is written to standard output. rcs will print errors if certain things go wrong. It will also print a few lines each time changetrack is run after a new file is added to the configuration. IDENTIFICATION
Author: Cameron J. Morland. Manual Page Revision: 2.1 Release Date: 2001-03-06. Copyright (C) 2001-2005 Cameron J. Morland. Changed by Jens Peter Secher to reflect the Debian modifications. SEE ALSO
ed(1), rcsintro(1), co(1) TODO
Automate removal of out-of-date changes, to save disk space and clarify the important changes. BUGS
None known. CHANGETRACK(1)
All times are GMT -4. The time now is 01:51 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy