How to check whether server is up or down by monitoring PID?


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting How to check whether server is up or down by monitoring PID?
# 1  
Old 06-02-2010
How to check whether server is up or down by monitoring PID?

we have a server, which becomes down at times and we dont get any notification mail.

Can we monitor PID for that server run and create a script to send notification to a mail id?

I have URL for the server, which I can use.
Please let me know if more information is required from my end to clarify the requirment.

Please provide easy to apply solution..

thanks in advance!!
# 2  
Old 06-02-2010
In my experience just because the PID exists, it doesn't mean that the server is up and running.

If it is a web server that you are monitoring, try using wget periodically. You can then grep the output to check for expected html content.

For other types of servers, something similar can be done.

Peace
# 3  
Old 06-02-2010
if its not a webserver, if its just a server running on unix. u can easily use
Code:
#!/usr/bin/ksh

SERV_ERR=0
ps -eaf | grep "ashasas" > log.txt
if [ $? ]
then
       SERV_ERR=1
fi

if [[ $SERV_ERR -gt 0 ]]
then
echo "we got problems"
mailx "to ur mail"
fi

see if this solves the purpose
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Pid file and process check

Hello, I am running ubuntu14.04 What I am trying to do is restart a process with a shell when pid is dead. I restored pid nr in a file and check with ps aux | grep -v grep | grep $(cat *.pid)| awk '{ print $2 }' While surfing on google, I have found an answer saying that restoring pid in a... (2 Replies)
Discussion started by: baris35
2 Replies

2. Infrastructure Monitoring

Tuxedo server monitoring

Hi I like to use tmadmin commands to monitor running application in tuxedo server 12c.But When i use tmadmin help command i get only meta commands.But i like to check printconn,printclient,printserver like that.But these commands are not avaialble in list.I here pasted the help command... (0 Replies)
Discussion started by: selva1587
0 Replies

3. Shell Programming and Scripting

Check if PID exists

In a Shell Script what is the most generic way to find in the PID exists or not. If it does not exist how can I echo the user "PID does not exist" & terminate the unix script ? If the command can work on most flavors of operating system the more useful I will find it to be. Current system... (16 Replies)
Discussion started by: mohtashims
16 Replies

4. UNIX for Dummies Questions & Answers

Check who is writing to a file? (pid)

Hello, is there a way to check who is writing to a file? (pid) Like someone starts a ftp transfer, is uploading a file and I'd need to know which pid is actually writing to it. Or is there a way to check which file a process is currently accessing? Greetings and thanks for all your... (4 Replies)
Discussion started by: TehOne
4 Replies

5. Shell Programming and Scripting

Monitoring script to check if cm cluster is up or not.

hi guys have this little problem, need some help from script gurus. basically I'm running hpux cmviewcl command, cmviewcl command will produce db1pkg up running enabled box1 my script PSV='box1' STAT='up' check_db1pkg() { # assign cmviewcl output... (2 Replies)
Discussion started by: sparcguy
2 Replies

6. Shell Programming and Scripting

Check process running Status with PID

Good day I am fairly new to Shell Scripting. I want a script to check if a process is up by checking the process's PID and then return a value for when it's running which would be 0. If it isn't running it should give any other value that 0. Any Help is appreciated Regards (9 Replies)
Discussion started by: 1nsyz1on
9 Replies

7. Shell Programming and Scripting

Trouble getting consistent PID of tomcat server from ps

Hello all, I am working on a script to automate the process of restarting some tomcat servers. The versions of tomcat are pretty old and it often happens that they don't shut down gracefully and the PID needs to be manually killed. I am having a bear of a time getting a consistent PID from ps... (1 Reply)
Discussion started by: dkaplowitz
1 Replies

8. Shell Programming and Scripting

How to check if a pid is alive?

I want to do some operations provided the pid is active. (6 Replies)
Discussion started by: ScriptDummy
6 Replies

9. Shell Programming and Scripting

Script to check status of a PID

i'm just learning scripting, and have been banging my head against this I want to check if my WAS6 java process is running and if so..echo me a messages. If not then echo me a different messages the problem i have is I dont know how to represent a NULL return value. If i grep for a was6... (14 Replies)
Discussion started by: zeekblack
14 Replies

10. UNIX for Advanced & Expert Users

monitoring server

Hello, I work with 4 flavour of UNIX ( AIX, IRIX, HPUX and SUN). I have a problem maintaing the system. can any one let me know of the software or script that will check the date,time services running or not, perticular machine is up or not and post a mail with all the details. It... (3 Replies)
Discussion started by: pradeepmacha
3 Replies
Login or Register to Ask a Question