Re: problem with shell script

2011-01-12 Thread Ryuichiro Hara

(2011/01/13 01:00), Warren Block wrote:

On Wed, 12 Jan 2011, Samuel Mart?n Moro wrote:

On Wed, Jan 12, 2011 at 3:50 PM, Chad Kellerman sunck...@gmail.com 
wrote:


On Wed, Jan 12, 2011 at 9:01 AM, Frank Bonnet f.bon...@esiee.fr 
wrote:



I'm in trouble with a simple shell script that give
erroneous value when running ...

If I run commands interactively everything runs well


ps ax | grep slapd | grep -v grep | wc -l

 1

If I run in the following shell script :

#!/bin/sh
SD=0
SD=`ps -ax | grep slapd | grep -v grep | wc -l`
echo $SD

the result is 3 !!!



ps ax | grep [/]slapd  | wc -l
may not fix the problem
but still cleaner


ps axc | grep slapd | wc -l

is a little neater.
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to 
freebsd-questions-unsubscr...@freebsd.org


hello.

i would rather use pgrep(1);
pgrep -afl slapd
for just counting purpose,
pgrep -a slapd | wc -l
is enough. i believe it should work all right as expected in `` output, 
as well.


___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: problem with shell script

2011-01-12 Thread Ryuichiro Hara

(2011/01/12 23:01), Frank Bonnet wrote:

Hello

I'm in trouble with a simple shell script that give
erroneous value when running ...

If I run commands interactively everything runs well

 ps ax | grep slapd | grep -v grep | wc -l
  1

If I run in the following shell script :

#!/bin/sh
SD=0
SD=`ps -ax | grep slapd | grep -v grep | wc -l`
echo $SD

the result is 3 !!!


Any info welcome !

___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to 
freebsd-questions-unsubscr...@freebsd.org


hello.

i would rather use pgrep(1);
pgrep -afl slapd

for just counting purpose,
pgrep -a slapd | wc -l
is enough. it should work as expected in `` output.
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: Simple command to reset / clear all logs?

2011-01-12 Thread Ryuichiro Hara

Hello,

It might be all right to remove all normal file logs,
though you may want to retain all subdirectories.

find /var/log -type f -exec rm {} \;

may do.

# sorry. I wouldn't do that rough and not tested.
# Basically, those are just incremental logs, whose
# lines are mostly not referred by running system.



(2011/01/13 01:04), Redd Vinylene wrote:

Hi,

Is there a simple command to reset / clear everything in my /var/log? I've
done a lot of testing, configuring, trial and error and most of my logs are
just full of bullshit and I'd like a fresh start :-)

Thanks!
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org