Process Watcher (pswatch)

Posted on August 15, 2012

0


This command runs Unix `ps` command periodically and reports to the user either by email, sms or desktop notification about the process. It can be used for example to monitor length processes. Here at CERN I am working on profiling AliRoot. To get more info on what is AliRoot please go through my previous blog entry.

How it Works

pswatch runs a itz own daemon process (`pswatch.sh`) which periodically checks the existence of the processes in the watch list. The script `psadd.sh` is used to add process on the watch list. `psls.sh` lists the processes on the watch list. `psrm.sh` used to remove a process from the watch list. The process watch lists are maintained as files in the temporary folder. These files store information about each of the process on the watch list in addition to how the process completion has to be notified. The configuration file is $HOME/.pswatchrc

Download

The entire source code can be downloaded from here. Please go through the README file for more detail.

Installation

untar the source code and execute the installation script INSTALL

$ tar -xvf pswatch.tar.gz
$ sh INSTALL

Usage

pswatch.sh

The daemon process. To start it run as `nohup pswatch.sh &`. Please note that you cannot add processes on the watch list until the daemon is active. So first step to do is to run the daemon.

$ nohup pswatch &

psadd.sh

Add process on the watch list. Use as `psadd.sh 2343 SMS DESKTOP`. 2343 is the PID of the process. After that it can have at max 3 options. SMS, DESKTOP, EMAIL. You need to specify the email address etc on the file $HOME/.pswatchrc

$ psadd.sh 2343 SMS DESKTOP

psls.sh

List process on the watch list. Use as `psls.sh`

$ psls.sh

psrm.sh

Remove process from the watch list. Use as `psrm.sh 2343`.

$ psrm.sh 2343

About

This software developed my Manohar Kuse. In case of problems in it do not hesitate of contact.

mkuse ]]AT[[ cern.ch
swaroopcool21 ]]AT[[ gmail.com
Advertisements
Tagged: ,
Posted in: Softwares