#!/bin/sh
VERSION=260521
SCRIPT=$(readlink -f $0)
SCRIPTNAME=$(basename $SCRIPT)
SCRIPTDIR=$(dirname $SCRIPT)
if [ "$1" = "-v" ] ; then echo "$VERSION $SCRIPTNAME $SCRIPTDIR";exit 0; fi
if [ -e "$SCRIPTDIR/esc.sh" ] ; then . "$SCRIPTDIR/esc.sh"; fi
LOG=$LOGDIR/log-$SCRIPTNAME.log

#esxcli system ntp set -e no
if [ "$1" == "ntp" ] ; then
	#http://rtfmp.github.io/vmware-esxi-ntp/
	chkconfig ntpd off
	chkconfig --list | grep ntpd
	sed -i 's/ntpserver/newntpserver/' /etc/ntp.conf
	sed -i 's/ntpserver//' /etc/ntp.conf
	sed -i  '/^\s*$/d' /etc/ntp.conf
	cat <<EOF > /etc/ntp.conf
restrict 127.0.0.1
restrict default kod nomodify notrap
server 0.pool.ntp.org
server 1.pool.ntp.org
driftfile /etc/ntp.drift
EOF
cat /etc/ntp.conf
	chkconfig ntpd on
fi
