Re: .sh interactive ok, from crontab, not

2002-11-25 Thread Matthew Seaman
On Mon, Nov 25, 2002 at 07:47:46AM +0100, Len Conrad wrote: > >Try running 'ps' using the -w flag (wide column mode): > > > > if ( ps -auxw | grep -iq "^root.*master" ) ; then > > > >I've tested this and it works. > > here, too, thanks!! One -w switches from 80 column width to 132 column width,

Re: .sh interactive ok, from crontab, not

2002-11-24 Thread Len Conrad
Okay, I was able to duplicate your problem. It is due to the output of 'ps' being truncated to 80 columns, the default terminal size. You are likely running a wide terminal display on your interactive session (as I do) yep, TeraTerm on Windows, very wide display. but cron will see the default

Re: .sh interactive ok, from crontab, not

2002-11-24 Thread Paul A. Scott
Oh, besides (or instead of) using the -w flag, you might also consider just shorting the width of the output lines. Since you don't need all the information between the user and command fields, you could just use: if ( ps -ax -o user,command | grep -iq "^root.*master" ) ; then Another possibilit

Re: .sh interactive ok, from crontab, not

2002-11-24 Thread Paul A. Scott
Okay, I was able to duplicate your problem. It is due to the output of 'ps' being truncated to 80 columns, the default terminal size. You are likely running a wide terminal display on your interactive session (as I do) but cron will see the default 80 column terminal. This is the difference betwee

Re: .sh interactive ok, from crontab, not

2002-11-24 Thread Len Conrad
What does your crontab entry look like? */10* * * * root/usr/local/bin/watchdog.sh To Unsubscribe: send mail to [EMAIL PROTECTED] with "unsubscribe freebsd-questions" in the body of the message

Re: .sh interactive ok, from crontab, not

2002-11-24 Thread Paul A. Scott
> I forgot to mention, "I'm blue in the face" Sorry, didn't know what you'd already done. Thought I had to ask. > ... but your version, or my multiple versions, have never mishaved from the > command line, it's running from crontab that does comes out inverted. What does your crontab entry look

Re: .sh interactive ok, from crontab, not

2002-11-24 Thread Len Conrad
Well, it was just a guess. :) I tested against my 'named' daemon, using the code you supplied and it works fine. same code works fine for my AV daemon, but not for the MTA daemon What version of FreeBSD? 4.5 Are you using the 'stock' shell? yes Did you look at the output from grep t

Re: .sh interactive ok, from crontab, not

2002-11-24 Thread Paul A. Scott
>> From: Len Conrad <[EMAIL PROTECTED]> >> It works for me, and I suspect that it's working for you, too. > > well, it's really not. The crontab execution is trying to run the daemon > even when the daemon shows up in "ps aux". Well, it was just a guess. :) I tested against my 'named' daemon, u

Re: .sh interactive ok, from crontab, not

2002-11-24 Thread Len Conrad
> if ( ps aux | grep -i "^root.*master" ) > /dev/null > then > echo "then: exit code equal 0" > exit 0 > else > > > ... when run from the command line, the echo text displays. But, when run > from crontab every 10 minutes, the if fails, and the else clause runs. > > I've tried every syntax I kno

Re: .sh interactive ok, from crontab, not

2002-11-24 Thread Paul A. Scott
> From: Len Conrad <[EMAIL PROTECTED]> > This snippet works fine... > > if ( ps aux | grep -i "^root.*master" ) > /dev/null > then > echo "then: exit code equal 0" > exit 0 > else > > > ... when run from the command line, the echo text displays. But, when run > from crontab every 10 minutes,

.sh interactive ok, from crontab, not

2002-11-24 Thread Len Conrad
Trying to write a little watch-dog/keep-alive script for a couple of related daemons, an MTA and an SMTP AV scanner. This snippet works fine... if ( ps aux | grep -i "^root.*master" ) > /dev/null then echo "then: exit code equal 0" exit 0 else ... when run from the command line, the echo text