Skip to content

Instantly share code, notes, and snippets.

@antsmartian
Created July 14, 2012 11:36
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save antsmartian/3110766 to your computer and use it in GitHub Desktop.
Save antsmartian/3110766 to your computer and use it in GitHub Desktop.
Shell script for syn with ntp servers for proper time.
#!/bin/bash
#Call the config file . .
source configFile.sh
#Install ntp on the server
sudo apt-get install ntp
#The config files for ntp lies in /etc/ntp.conf.
#We are changing the Servers time to our nearest geo location.
#Look here for more info : http://www.pool.ntp.org/zone/in
sed -i "s/server 0.ubuntu.pool.ntp.org/server 1.in.pool.ntp.org/g" /etc/ntp.conf
sed -i "s/server 1.ubuntu.pool.ntp.org/server 1.asia.pool.ntp.org/g" /etc/ntp.conf
sed -i "s/server 2.ubuntu.pool.ntp.org/server 2.asia.pool.ntp.org/g" /etc/ntp.conf
sed -i "s/server 3.ubuntu.pool.ntp.org//g" /etc/ntp.conf
#Restart the service.
sudo service ntp restart
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment