On 4/20/07, Nigel Henry <[EMAIL PROTECTED]> wrote:
> On Friday 20 April 2007 14:50, Bob Beers wrote:
> > On 4/19/07, Nigel Henry <[EMAIL PROTECTED]> wrote:
> > > The problems are with FC2. I know it's old, but I still receive all my
> > > mail on it, and use it daily. I think what I really need is a script that
> > > detects when an Internet connection is up and running, then starts ntpd.
> > > I'm not too clever with scripts. I'll ask around, and see if some kind
> > > hearted scripter can suggest something.
> >
> > How about something like this in a root cronjob:
> >
> > [[ $( ps axf | grep -c ntpd ) -eq 0 ]] && {
> >     SRV=( $(grep ^server /etc/ntp.conf ) )
> >     ping -c 3 -w 2 ${SRV[1]}
> >     [[ $? -eq 0 ] && /usr/sbin/ntpd -g
> > }
> >
> > HTH,
> > -Bob
>
> Hi Bob. Thanks for the script. I thought I'd just set it up in /usr/local/bin
> as an executable shell script at first to try it out.

Well, if you can overcome my bad typing and poor assumptions
 about file locations, you may end up with something that works. :)

>
> Got a problem when trying to run it, with a command not found, and with a bit
> more work I get this.
>
>  [EMAIL PROTECTED] bin]# ntpstartnointernet
> /usr/local/bin/ntpstartnointernet: line 6: syntax error in conditional
> expression
> /usr/local/bin/ntpstartnointernet: line 6: syntax error near `]'
> /usr/local/bin/ntpstartnointernet: line 6: `    [[ $? -eq 0 ]

yeah, sorry, typo:  [[ needs a matching ]],
 or your can go with the more traditional style:

if [ $/ -eq 0 ]; then
   /usr/local/bin/ntpd -g
fi

same applies for the first conditional which attempts to
 verify that ntpd is not already running.

> && /usr/local/bin/ntpd -g'
> [EMAIL PROTECTED] bin]#
>
> any suggestions on a fix?
>
> I changed /usr/sbin/ntpd to /usr/local/bin/ntpd as that is where the 4.2.4p0
> version is installed.

ok.

>
> btw. ntpstartnointernet is the name of your script.
>
> Nigel.
> _______________________________________________
> questions mailing list
> [email protected]
> https://lists.ntp.isc.org/mailman/listinfo/questions
>
_______________________________________________
questions mailing list
[email protected]
https://lists.ntp.isc.org/mailman/listinfo/questions

Reply via email to