Skip to content

Commit 52ccae2

Browse files
committed
Merge pull request alphagov#4 from alphagov/ntp_reset
Ntp reset
2 parents c489348 + 12c43d6 commit 52ccae2

File tree

2 files changed

+18
-0
lines changed

2 files changed

+18
-0
lines changed

fabfile.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
import licensify
1616
import mongo
1717
import nginx
18+
import ntp
1819
import puppet
1920
import rkhunter
2021
import search

ntp.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
from fabric.api import *
2+
3+
@task
4+
def status():
5+
"""Report the VM's NTP status."""
6+
run("/usr/lib/nagios/plugins/check_ntp_time -q -H ntp.ubuntu.com -w 2 -c 3")
7+
8+
@task
9+
def resync():
10+
"""Forcibly resynchronise the VM's NTP clock.
11+
12+
If a VM's clock manages to get sufficiently out of sync, ntp will give up,
13+
forcing a manual intervention.
14+
"""
15+
sudo("service ntp stop")
16+
sudo("ntpdate ntp.ubuntu.com")
17+
sudo("service ntp start")

0 commit comments

Comments
 (0)