Skip to content

Instantly share code, notes, and snippets.

@gvilarino
Created March 8, 2015 23:05
Show Gist options
  • Save gvilarino/b93e1ecc83c25e312294 to your computer and use it in GitHub Desktop.
Save gvilarino/b93e1ecc83c25e312294 to your computer and use it in GitHub Desktop.
Manual timer synch for azure deis
#!/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
@gvilarino
Copy link
Author

Run on each Azure deis node if they're restarted

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment