Created
March 8, 2015 23:05
-
-
Save gvilarino/b93e1ecc83c25e312294 to your computer and use it in GitHub Desktop.
Manual timer synch for azure deis
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/env bash | |
timer=$(cat <<EOF | |
[Unit] | |
Description=sync clock timer | |
[Timer] | |
OnCalendar=hourly | |
Unit=sync-clock-hourly.service | |
[Install] | |
WantedBy=default.target | |
EOF | |
) | |
service=$(cat <<EOF | |
[Unit] | |
Description=sync clock service | |
[Service] | |
Type=simple | |
ExecStart=/bin/bash -c "/usr/sbin/ntpdate -b -u $(cat /etc/ntp.conf | grep server | cut -d ' ' -f2 | tr '\n' ' ' )" | |
[Install] | |
WantedBy=default.target | |
EOF | |
) | |
echo "$timer" | sudo tee /run/systemd/system/sync-clock-hourly.timer | |
echo "$service" | sudo tee /run/systemd/system/sync-clock-hourly.service | |
sudo systemctl daemon-reload | |
sudo systemctl start sync-clock-hourly.timer | |
sudo systemctl enable sync-clock-hourly.service |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Run on each Azure deis node if they're restarted