Last active
December 10, 2015 21:08
-
-
Save ebisawa/4492584 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
modconf() { | |
conf=$1; before=$2; after=$3 | |
mode=`stat -c "%a" $conf` | |
tmpfile=`mktemp /tmp/__modconf.XXXXXX` | |
cat $conf | sudo sed -r "s/$before/$after/" >$tmpfile | |
mv $tmpfile $conf | |
chmod $mode $conf | |
rm -f $tmpfile | |
} | |
auto_apt_get() { | |
DEBIAN_FRONTEND=noninteractive apt-get -y --force-yes $* | |
} | |
auto_apt_get install ntp | |
modconf /etc/ntp.conf "server 0.ubuntu.pool.ntp.org" "server ntp.nict.jp" | |
modconf /etc/ntp.conf "server 1.ubuntu.pool.ntp.org" "server ntp1.jst.mfeed.ad.jp" | |
modconf /etc/ntp.conf "server 2.ubuntu.pool.ntp.org" "server ntp2.jst.mfeed.ad.jp" | |
modconf /etc/ntp.conf "server 3.ubuntu.pool.ntp.org" "server ntp3.jst.mfeed.ad.jp" | |
service ntp restart | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment