On 2002.09.22_13:00:44_+0000, Anders Åkesson wrote:
> Hi!
> 

Hi,

> I have wondered why my firewall never updates it's hw or sys clock
> although it should. I found that the updatetime script in
> /etc/multicron-d doesn't work.
> 
> updatetime () {
> 
>         [ -f /etc/default/rcS ] && . /etc/default/rcS
>         [ "$GMT" = "-u" ] && GMT="--utc"
>         if [ -n "`ps axc | grep xntpd`" ]; then
>                 hwclock --systohc $GMT
>         else
>                 [ "$lrp_DATE_SERVER" != "" ] \
>                         && rdate -s $lrp_DATE_SERVER \
>                         && sleep 2 && hwclock --systohc $GMT
>         fi
> }
> 
> This code will ALWAYS go into the first option of the if-statement. 
> 
> The length of "`ps axc | grep xntpd`" will always be non-zero because
> 'grep xntpd' will be launched as a new process due to the pipe. 
> 

No, the shell will return the value from the grep appropriately. I
haven't tested this with ash (the shell used by Bering). Only with ksh, 
so I may be wrong. Following commands prove my statement:

$ ps axc | grep xntpd
$ echo $?
1
$ ps axc | grep getty
  494 tty1     S      0:00 getty
  495 tty2     S      0:00 getty
  [...]
$ echo $?
0

CMIIW

> 
> /Anders
> 

-- 
H. D. Lee



-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
------------------------------------------------------------------------
leaf-user mailing list: [EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/leaf-user
SR FAQ: http://leaf-project.org/pub/doc/docmanager/docid_1891.html

Reply via email to