- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- checking conditions
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Discussions
Discussions
Discussions
Forums
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-11-2001 08:48 AM
тАО10-11-2001 08:48 AM
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-11-2001 08:51 AM
тАО10-11-2001 08:51 AM
Solutionfunction _not_running {
RUNNING=$(ps -ef|grep "$0"|grep -v grep|grep -v $$|grep -v man)
if [[ "$RUNNING" != "" ]]
then
PID=$(echo ${RUNNING} | awk {"print \$2;exit"})
echo "\nERROR: The tool is already running under pid: ${PID}\n"
echo "You must wait until it completes.\n"
exit 1
fi
}
you can modify the important bit into your loop with
for i in $(ps -ef | grep.... $LIST)
do
done
Later,
Bill
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-11-2001 09:04 AM
тАО10-11-2001 09:04 AM
Re: checking conditions
if [ ?( "abc" "def" "ghi" ) ]
then
# match
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-11-2001 09:08 AM
тАО10-11-2001 09:08 AM
Re: checking conditions
Consider using XPG4 version of ps. It is a very good tool for this kind of checks.
UNIX95= ps -e -o "args" |sort >> running_procs
You can use this output to tackle your problem
Now you can use your list to compare what's in there.
STAMP=0
for PROC in `cat my_list`
do
grep $PROC running_procs > /dev/null 2>&1
if [ $? = 0 ]
then
echo "PROC is running"
STAMP=1
fi
done
if [ $STAMP = 1 ] (This means atleast one of the processes that are there in the list is running)
then
do_whatever_you_want
fi
Does this help?.
-Sri
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-11-2001 09:18 AM
тАО10-11-2001 09:18 AM
Re: checking conditions
Harry, Is there a bin/sh format for that example?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-11-2001 10:34 AM
тАО10-11-2001 10:34 AM
Re: checking conditions
ps -aef | grep -e "abd" -e "cde" -e ....
find processes
ps -aef | grep -v -e "abd" -e "cde" -e ....
Find all process except..
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-11-2001 12:55 PM
тАО10-11-2001 12:55 PM