Created
September 4, 2015 12:32
Sync NTP Time Background Process
This file contains hidden or 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 | |
# | |
# Run me like this: "sudo bash sync-time.sh" | |
# | |
PID=/var/run/sync-time.pid | |
GREP=$(ps aux | grep $PID) | |
GREP_RC=$? | |
if [[ -f $PID && $GREP_RC == 0 ]]; then | |
echo "Process already running" | |
exit 0 | |
fi | |
while true; do sudo ntpclient -s -h 83.231.183.4; sleep 30; done &> /dev/null & | |
echo "$!" > $PID | |
disown |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment