sync ntp cron script.

Just a little script to sync the localtime against a ntp server using cron.

#!/bin/bash
# Sync time next to ntp daemon
# Chris 5-2-1010
NTPD=`find /etc/init.d/ -name "ntpd"`;
echo $NTPD;
NTPDATE=`which ntpdate`;
if [ -f $NTPD ]; then
        STDOUT=`$NTPD stop`;
        if [ -f $NTPDATE ]; then
                STDOUT=`$NTPDATE 10.252.252.2`;
                STDOUT=`$NTPD start`;
        else
                STDOUT=`$NTPD start`;
        fi
else
        exit 1;
fi
exit 0;
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

w

Connecting to %s