> > > 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 > > This may be a wrong way to proof thing, as I state so in another mail > following this, in the same thread. But I could still see zero length of > string returned. > > > $ ps axc | grep getty > > 494 tty1 S 0:00 getty > > 495 tty2 S 0:00 getty > > [...] > > $ echo $? > > 0 > > > > I have created a script just to test this: > $ cat try > #! /bin/sh > > if [ -n "`ps axc | grep xntpd`" ]; then > echo "not zero." > else > echo "zero." > fi > > if [ -n "`ps axc | grep getty`" ]; then > echo "not zero." > else > echo "zero." > fi > > $ ./try > zero. > not zero. > > As above, I am not running xntpd, but getty exist on the process list. > > HTH
Ok.. I get your point. If I run the same script on my firewall it returns: [root@firewall] /root # ./try not zero. not zero. [root@firewall] /root # There's my problem. I do NOT have xntpd running either. Instead the ps command lists "grep xntpd" as containing "xntpd" which is correct, but not the wanted behaivor. 'sh -x try' gives: [root@firewall] /root # sh -x try + ps axc + grep xntpd + [ -n 2569 root 892 S grep xntpd ] + echo not zero. not zero. + ps axc + grep getty + [ -n 721 root 948 S /sbin/getty 38400 tty1 722 root 948 S /sbin/getty 38400 tty2 18571 root 888 S grep getty ] + echo not zero. not zero. [root@firewall] /root # Is it clearer now? /Anders ------------------------------------------------------- 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