The UNIX and Linux Forums  


Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com



Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Killing of a process and send a mail if the process doesnot come up within 2 minutes Prince89 Shell Programming and Scripting 1 02-15-2008 07:10 PM
how to check if a process is running in a server from shell script. debu UNIX for Advanced & Expert Users 2 01-24-2008 05:19 PM
How to create a dummy process of a process already running? shambhu UNIX for Advanced & Expert Users 3 08-31-2007 11:22 AM
how to get the list of process running in the server from the local machin n unix ? guhas Shell Programming and Scripting 3 10-04-2005 04:58 PM
How to monitor if a process is running Pedro Tavares High Level Programming 3 11-14-2001 03:34 PM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 03-29-2005
pradeepmacha pradeepmacha is offline
Registered User
  
 

Join Date: Mar 2005
Posts: 20
Question process running on server and mail

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.
  #2 (permalink)  
Old 04-25-2005
pradeepmacha pradeepmacha is offline
Registered User
  
 

Join Date: Mar 2005
Posts: 20
server process monitoring via mail

hi guys,
i'm back with a small problem.
i have now written a script that will grep for a process and will notify me if not running.
[#!/bin/ksh
pid=""
pid='ps -ef | grep "<process string>" | awk ' {print $2}''
echo $pid
if [ "$pid"="" ]
then
echo "process not running"
rsh <mail server> mailx -s "<etc etc process not running>" <mail.id>
else
echo service is ok
pid=""
fi
]
now i'm have a problem in the mailing section.
can any one tell me how i can redirect the output to a file and send it via mail if the process i'm greping is not runnning. i tried the above syntax and failed.

And one more help how can i find the parent process that aare running so that i can make a list of those important process.

kindly some one look into this and reply at earliest.

Regards,
Pradeep Kulkarni
  #3 (permalink)  
Old 04-25-2005
RTM's Avatar
RTM RTM is offline Forum Advisor  
Hog Hunter
  
 

Join Date: Apr 2002
Location: On my motorcycle
Posts: 3,039
Instead of
rsh <mail server> mailx -s "<etc etc process not running>" <mail.id>
try
mailx -s "<etc etc process not running>" yourID@yourdomain.xxx < /dev/null

Change yourID and yourdomain.xxx to your userid and domain name.
  #4 (permalink)  
Old 04-26-2005
pradeepmacha pradeepmacha is offline
Registered User
  
 

Join Date: Mar 2005
Posts: 20
hi RTM,
Thanks for the update it works, one small help how can i liist all the parent process running on a unix machine, so that i can grep for only those.
i have all unix machine ( HPUX, AIX, SUN and IRIX)can you help me on this.

Thanks in advance.

Regards,
Pradeep Kulkarni.
  #5 (permalink)  
Old 04-27-2005
RishiPahuja's Avatar
RishiPahuja RishiPahuja is offline
Registered User
  
 

Join Date: Apr 2005
Location: Bangalore, India
Posts: 203
Cool

To know the parent process use:

ptree [PID]

/usr/bin/ptree [ -a ] [ [ pid | user ] ... ]

ptree Print the process trees containing the specified pids
or users, with child processes indented from their
respective parent processes. An argument of all digits
is taken to be a process-id, otherwise it is assumed
to be a user login name. Default is all processes.
  #6 (permalink)  
Old 07-12-2005
pradeepmacha pradeepmacha is offline
Registered User
  
 

Join Date: Mar 2005
Posts: 20
hi,
i have a new problem, i had problem with time on my aix machine the date had changed to 2022 year, now i want to find all the files in the dir and sub dir that has the time stamp with year 2022, can any one help me on this. i tried with find command but could nott formate an expression.

Kindly help me.
Thanks in advance
Pradeep Kulkarni.
  #7 (permalink)  
Old 07-12-2005
vino's Avatar
vino vino is offline Forum Staff  
Supporter (in vino veritas)
  
 

Join Date: Feb 2005
Location: Bangalore, India
Posts: 2,798
Pradeep,

This new problem is not in any way related to your 'process' post.

Advise you to start a new thread for a new problem (always).

Vino
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 11:17 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0