On 4/13/06, Atul Tyagi <[EMAIL PROTECTED]> wrote:
>
>
> --- Ritesh Raj Sarraf <[EMAIL PROTECTED]> wrote:
>
> > > status $PROCESS
> > > STATE=$?
> >
> > Is status a command ??
>
> Sorry I didn't mention about that. Its basically a function specified in
> Redhat systems in
> /etc/init.d/functions.
>
> Following is the code for status
>
> status() {
> local base=${1##*/}
> local pid
>
> # Test syntax.
> if [ "$#" = 0 ] ; then
> echo $"Usage: status {program}"
> return 1
> fi
>
> # First try "pidof"
> pid=`pidof -o $$ -o $PPID -o %PPID -x $1 || \
> pidof -o $$ -o $PPID -o %PPID -x ${base}`
> if [ -n "$pid" ]; then
> echo $"${base} (pid $pid) is running..."
> return 0
> fi
>
> # Next try "/var/run/*.pid" files
> if [ -f /var/run/${base}.pid ] ; then
> read pid < /var/run/${base}.pid
> if [ -n "$pid" ]; then
> echo $"${base} dead but pid file exists"
> return 1
> fi
> fi
> # See if /var/lock/subsys/${base} exists
> if [ -f /var/lock/subsys/${base} ]; then
> echo $"${base} dead but subsys locked"
> return 2
> fi
> echo $"${base} is stopped"
> return 3
> }
>
>
> Regards,
>
> Atul
>
>
>
> __________________________________________________________
> Yahoo! India Matrimony: Find your partner now. Go to
> http://yahoo.shaadi.com
>
> _______________________________________________
> ilugd mailinglist -- [email protected]
> http://frodo.hserus.net/mailman/listinfo/ilugd
> Archives at: http://news.gmane.org/gmane.user-groups.linux.delhi
> http://www.mail-archive.com/[email protected]/
>
> Hi all,
I have a very simple script and does want to know that will it solve the
purpose. I am pasting the one below:
#!/bin/bash
if [`ps -e | grep 'run_process.sh' | grep -v 'grep' | head -n 1` -eq '']
then
`/home/abhishek\ jain/scripts/run_process.sh >output.log 2>error.log`
else
#Do nothing
echo "jain"
fi
The name of the script is check_process and checks the process of
run_process.sh .
Your comments are appreciated.
Thanks,
Abhishek Jain
_______________________________________________
ilugd mailinglist -- [email protected]
http://frodo.hserus.net/mailman/listinfo/ilugd
Archives at: http://news.gmane.org/gmane.user-groups.linux.delhi
http://www.mail-archive.com/[email protected]/