- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Shell Script checking processes
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
Forums
Discussions
Discussions
Discussions
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
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
11-17-2003 03:15 AM
11-17-2003 03:15 AM
For a few servers running OS=HP-UX 11.0
1. Check on processes running from a file, third column of a file
2. If running do nothing (and if was previously "not running" send e-mail saying is UP again and exit, once it has notified, don't bother to inform again!).
3. If not running, send e-mail to inform (keep the status to check on next run if process came up).
Hope I was "crystal clear" on my question!
Does anybody have such a script?, since I believe must be a common issue actually, any help would be greatly appreciated.
Couldn't get it to work properly myself.
Thanks a lot
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-17-2003 03:23 AM
11-17-2003 03:23 AM
Re: Shell Script checking processes
-- Graham
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-17-2003 03:27 AM
11-17-2003 03:27 AM
Re: Shell Script checking processes
Where $VAL -ge 1, the 1 is the number of procs you are validating are supposed to be running. In my case the number is 4, but for you maybe only 1
-------------------------------------------
VAL=0
echo $VAL
VAL=`ps -aef|grep
echo $VAL
if [ $VAL -ge 1 ]
then echo "Services are running";ps -aef|grep -e
grep|grep -v <scriptname>;date
else mailx -s "Services" root < /root/process.notice
fi
--------------------------------------------
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-17-2003 03:27 AM
11-17-2003 03:27 AM
Re: Shell Script checking processes
I'm already using opcmsg to accomplish part of it, but OP would like e-mail notifications.
Thanks again.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-17-2003 04:42 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-17-2003 06:00 AM
11-17-2003 06:00 AM
Re: Shell Script checking processes
Todd, your script works great, had my own script working close to that, but still doesn't provide with the information/status, regarding whenever a process previously was DOWN and now is back UP again, I did test it but didn't seem to work that way.
Now, Michael, yours works great, but seems I really have a problem getting correctly the processes from my file, such as:
COMMAND=`cat /var/opt/OV/conf/OpC/procmon.conf | awk '{ print $3 }'`
Is there a better way to do this?A proper way?
Since this file /var/opt/OV/conf/OpC/procmon.conf looks like this:
1 OS inetd Exact 1 Critical 2
1 OS sshd Min 1 Critical 2
Any help is much appreciated guys, thanks for your quick and proper response.
Best regards.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-17-2003 10:03 PM
11-17-2003 10:03 PM
Re: Shell Script checking processes
if you have more than one process in your config file, you have a problem.
try this
while read F1 F2 PROCESS F4 F5 F6
do
checkproc ${PROCESS} &
done < /var/opt/OV/conf/OpC/procmon.conf
greetings,
Michael
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-18-2003 12:17 AM
11-18-2003 12:17 AM
Re: Shell Script checking processes
I have redone my script.
greetings,
Michael
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-18-2003 05:08 AM
11-18-2003 05:08 AM
Re: Shell Script checking processes
I've only modified this:
"Min") COMPAREON[${NUMPROC}]="-eq";;
Replaced "-gt" with "-eq", so it notifies perfectly whenever a process comes up again.
I really appreciate guys your help, and even more, in such a short period of time!
Thanks again!
If there is a way to assign more point to you guys,let me know!
Best regards,
C.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-18-2003 10:05 PM
11-18-2003 10:05 PM
Re: Shell Script checking processes
just curious, can you explain the meaning of the fields in the config file? I thought Min means minimum, so if 2 processes are running then the script will complain again. The script was designed to mail once, when the minimum number of processes are running. Am I missing something?
greetings,
Michael
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-19-2003 06:04 AM
11-19-2003 06:04 AM
Re: Shell Script checking processes
1=check for process
OS=OS process
inetd=name of process
Exact=condition Min-Max or Exact
1=number of times running (Exact 1 time, Min 1 time) etc...
Critical=status IF down
2=frequency
And in order to e-mail once, had to add the following test:
else
test ${NOTIFIED[${COUNT}]}="YES" && echo "Service down...etc...
This way it only sends one e-mail to notify for a process DOWN, and only one e-amil to notify a process is UP again, works great!
Thanks again!
Best regards,
C.