#!/bin/bash

# Check if root
if [ "$EUID" -ne 0 ]
  then echo "Please run as root"
  exit 1
fi

DIR=$(cd `dirname $0` && pwd)
echo $DIR/ntp.conf.tmpl

ntp_server="$1"
ntp_config='/etc/ntp.conf'

cat "$DIR/ntp.conf.tmpl" | sed "s/::servers::/$ntp_server/" > /etc/ntp.conf
cat "$DIR/ntp.conf.tmpl" | sed "s/::servers::/$ntp_server/" > /etc/salicru/config/ntp.conf

sudo service ntp restart
