use cron to run ntpdate

This commit is contained in:
j 2015-01-19 18:47:46 +01:00
parent a8ca6fbb96
commit 35beda48f3

View file

@ -159,15 +159,11 @@ if [ "$LXC" == "yes" ]; then
fi fi
if [ "$LXC" == "no" ]; then if [ "$LXC" == "no" ]; then
cat > /usr/local/bin/fixtime <<EOF cat > /etc/cron.d/ntp_fixtime <<EOF
#!/bin/bash # /etc/cron.d/ntp_fixtime: vms can go out of sync, run ntpdate to sync time
while [ 1 ]; do
/usr/sbin/ntpdate pool.ntp.org >/dev/null */10 * * * * root /usr/sbin/ntpdate pool.ntp.org >/dev/null
sleep 600
done
EOF EOF
chmod +x /usr/local/bin/fixtime
fi
cat > /usr/local/bin/genissue <<EOF cat > /usr/local/bin/genissue <<EOF
#!/bin/sh #!/bin/sh
@ -187,22 +183,15 @@ chmod +x /usr/local/bin/genissue
cat > /etc/rc.local << EOF cat > /etc/rc.local << EOF
#!/bin/sh -e #!/bin/sh -e
#vm has one network interface and that might change, make it not persistent #vm has one network interface and that might change, make sure its not persistent
rm -f /etc/udev/rules.d/70-persistent-net.rules rm -f /etc/udev/rules.d/70-persistent-net.rules
#update issue #update issue
/usr/local/bin/genissue > /etc/issue /usr/local/bin/genissue > /etc/issue
EOF EOF
if [ "$LXC" == "no" ]; then
cat >> /etc/rc.local << EOF
#vm can be suspended, this help to keep the time in sync
/usr/local/bin/fixtime &
EOF
fi
chmod +x /etc/rc.local chmod +x /etc/rc.local
apt-get clean
cat > /home/pandora/.vimrc <<EOF cat > /home/pandora/.vimrc <<EOF
set nocompatible set nocompatible
@ -242,4 +231,3 @@ nnoremap <F2> :set invpaste paste?<CR>
set pastetoggle=<F2> set pastetoggle=<F2>
set showmode set showmode
EOF EOF
apt-get clean