[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: shell script problem



whenever i want a script to run not from the command line,
i assume nothing and give full path to everything

try full path on ps, grep,wc etc.

HTH
erez.


Itamar S.-T. wrote:
> 
> The folowing shell script is supposed to check whether pnserver is running and
> if it isn't to restart it.  It resides in /usr/local/pnserver.  If I run it when
> I'm in that directory it works fine, but if I'm in a different directory (e.g.
> /root) it won't work.  Any idea what I'm doing wrong?
> 
> #!/bin/sh
> numps=`ps xa | grep pnserver | wc -l`
> if test $numps -lt "2"
> then
>         /usr/local/pnserver/bin/pnserver /usr/local/pnserver/server.cfg
> fi
> 
> --
> Whole Pop Magazine Online - this issue Motorcycles & Teddy Bears
> Pop Culture, Games and more at http://www.wholepop.com/
> Itamar, itamars@ibm.net