Unix Programming - Unix scripting

This is Interesting: Free IT Magazines  
Home > Archive > Unix Programming > January 2006 > Unix scripting





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author Unix scripting
tejal.acharya@gmail.com

2006-01-31, 7:21 pm

Hey I am new to the group..and to korn scripting....I have a script
that starts a process....i want to periodically check the status of my
process and output to the screen ' I am running'

How would i do that...
Tejal

Stephan Brönnimann

2006-01-31, 7:21 pm

tejal.acharya@gmail.com wrote:
> Hey I am new to the group..and to korn scripting....I have a script
> that starts a process....i want to periodically check the status of my
> process and output to the screen ' I am running'
>
> How would i do that...
> Tejal


Send the process to the background and use $! to see if the process
still exists:
#! /bin/sh

cmd="echo start; sleep 3; echo done"
chktime=1

(eval $cmd)&

pid=$!
while ps -p $pid >/dev/null 2>&1
do
echo "'$cmd' running"
sleep $chktime
done

Stephan

Sponsored Links






Free braindumps | Software forum | Database administration forum

Copyright 2003 - 2008 webservertalk.com