Sponsored Content
Top Forums Shell Programming and Scripting How to monitor some UNIX process and send notification in every 10 minutes? Post 302948893 by biswajitnitd on Friday 3rd of July 2015 04:52:24 PM
Old 07-03-2015
Hi Robin,
Thanks for the questions . I am new in the shell scripting.
So the processes I need to monitor. Like when the process get stopped unexpectedly , I need an alert. The Simple script like ,
Will this code work?? like or something more can i do ?
Code:
#!/bin/ksh
while true ; do
  isRunning=`ps -ef | grep -v grep | grep /home/unispool/bin/main`
  if [ $isRunning -eq 3 ]
    then
      echo "running"
    else
      echo "not running"
      mailx -s "Main process not running correctly" biswajit.nitd@yahoo.in < /dev/null
  fi

  isRunning1=`ps -ef | grep -v grep | grep /home/unispool/bin/cserver`
  if [ $isRunning1 -eq 4 ]
    then
      echo "running"
    else
      echo "not running"
      mailx -s "Cserver process not running correctly" biswajit.nitd@yahoo.in < /dev/null
  fi

  isRunning2=`ps -ef | grep -v grep | grep /home/unispool/bin/ciserver`
  if [ $isRunning2 -eq 3 ]
    then
      echo "running"
    else
      echo "not running"
      mailx -s "ciserver process not running correctly" biswajit.nitd@yahoo.in < /dev/null
  fi
done

Moderator's Comments:
Mod Comment When using CODE tags, the opening tag ([CODE]) must be placed before the text to be marked and the closing tag ([/CODE]) must be placed after the text to be marked.

Last edited by Don Cragun; 07-03-2015 at 06:21 PM.. Reason: Fix CODE tags.
 

10 More Discussions You Might Find Interesting

1. HP-UX

Event Monitor notification : Severity Serious : what does that mean ???

Hi I received this mail (root) on my hp-ux 11.00. >------------ Event Monitoring Service Event Notification ------------< Notification Time: Thu Mar 22 08:41:28 2007 hostname sent Event Monitor notification information: /storage/events/disks/default/0_0_1_1.0.0 is >= 3. Its current value... (6 Replies)
Discussion started by: touny
6 Replies

2. Shell Programming and Scripting

Killing of a process and send a mail if the process doesnot come up within 2 minutes

Hi Friends, I am new to this forum as well as new to shell scripting. I have a problem here and i need someone to solve this. Let us consider there are two processes(abc & def).There is a script which kills these two processes(i.e killtheprocess abc). Here abc is the argument . There is a... (1 Reply)
Discussion started by: Prince89
1 Replies

3. Shell Programming and Scripting

script to monitor process running on server and posting a mail if any process is dead

Hello all, I would be happy if any one could help me with a shell script that would determine all the processes running on a Unix server and post a mail if any of the process is not running or aborted. Thanks in advance Regards, pradeep kulkarni. :mad: (13 Replies)
Discussion started by: pradeepmacha
13 Replies

4. Shell Programming and Scripting

script to monitor the process system when a process from user takes longer than 15 min run.

get email notification from from system when a process from XXXX user takes longer than 15 min run.Let me know the time estimation for the same. hi ,any one please tell me , how to write a script to get email notification from system when a process from as mentioned above a xxxx user takes... (1 Reply)
Discussion started by: kirankrishna3
1 Replies

5. UNIX for Dummies Questions & Answers

Send Fault Alarm SMS Every 30 Minutes

Hi All, I am working in telecom sector. I want to send a fault alarm SMS in every 30 min. Ex.. If one alarm come at say 12:00 and its up say upto 18:00.in this case i want to send a SMS to concern person for every half an hour...can you plz suggest me script which will do the same Awaiting for... (0 Replies)
Discussion started by: sususa
0 Replies

6. Shell Programming and Scripting

check postfix deferred mail and send notification script

Hi Guys, I have a postfix server which is deferring emails. Now I need to send notification to a specific email address if: The sender of the deferred email is: abc@example.com Contains specific subjects: a file (/opt/subjects) contains all the subjects in place Then need to send a... (0 Replies)
Discussion started by: linuxrulz
0 Replies

7. Shell Programming and Scripting

Count the size and send notification

Hello, I want to do something simple, I want to count the dir size (du -sh directoryname) and then check if it is over 100GB. If it is more than 100GB I want to send a notification , if it less than 100GB the script can just stop. I know how to count with du -sh and how to send an email... (5 Replies)
Discussion started by: MaRiOsGR
5 Replies

8. Shell Programming and Scripting

Monitor and restart UNIX process

Hi all, Tearing my hair out..! I have a requirement to monitor and restart a unix process via a simple watchdog script. I have the following 3 scripts that dont work for me.. script 1 (only produces 1 output if process is up or not)... (4 Replies)
Discussion started by: jonnyd
4 Replies

9. HP-UX

Critical Sevices and Process to be monitor on UNIX servers

Need to note the list of critical / important services and process need to monitor on unix server always with one line explanation for severity. Thanks in advance. (5 Replies)
Discussion started by: marunmeera
5 Replies

10. Shell Programming and Scripting

How to send a file in UNIX through email which is created only 15 minutes before the current time?

I wanted to send an email to the client whenever there is failed record created in a /feed/HR-76/failed folder after processing of feed file. I can find out with the help of below script that what is the new file created but that file didn't make just 15 minutes before. ... (1 Reply)
Discussion started by: puneetkhullar
1 Replies
CSTARTEND(7)						 Miscellaneous Information Manual					      CSTARTEND(7)

NAME
cstartend - cWnn Startup and Termination DESCRIPTION
1. Startup of cserver ~~~~~~~~~~~~~~~~~~ To start up cWnn, first, you need to start the cserver. Type the following command at the C Shell prompt: % cserver <CR> The default path of cserver is "/usr/local/bin/cWnn4/". If the user has not set this path, he can either set it and type the com- mand directly, or type the full pathname of cserver while executing this command. cserver will only be started up once. You may confirm the existence of cserver by using the "cwnnstat" command. 2. Startup of client module, cuum ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ After starting cserver, the cWnn client module "cuum" may be started up. To start "cuum", type the following command at the C Shell prompt of a Chinese window: % cuum <CR> To activate other input environments, you may use the "-r" option of the "cuum" command together with the default path of that envi- ronment. For example, to activate Pinyin input environment, do the following: % cuum -r /usr/local/lib/wnn/zh_CN/rk_p <CR> The default path for "cuum" is "/usr/local/bin/cWnn4/". Many cuum's may be started at the same time on different windows. Each of them will be registered as a client at the cserver. After a startup message, the client module, cuum, is ready to be used. To enter the input mode, press ^. To leave the input mode, press ^ again. To confirm the existence of cuum, you may also use ^. 3. Termination of cuum ~~~~~~~~~~~~~~~~~~~~ In order to terminate a client process, press ^D. The cserver will save all the usage frequency files and dictionaries of the particular client and terminate the connection between itself and that client. 4. Termination of cserver ~~~~~~~~~~~~~~~~~~~~~~ To terminate the cserver, type the following command: % cwnnkill <CR> If some other clients still exist, a message will be displayed. In this case, you have to termiante all other client modules before you can terminate the cserver. NOTE
1. For details, refer to cWnn Manual Ver.4.1, Chapter 2. 13 May 1992 CSTARTEND(7)
All times are GMT -4. The time now is 01:06 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy