Skip to content

Instantly share code, notes, and snippets.

@hnnesv
Created February 19, 2013 09:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hnnesv/4984437 to your computer and use it in GitHub Desktop.
Save hnnesv/4984437 to your computer and use it in GitHub Desktop.
Tool for HIMMS Showcase 2013 - Set the system clock via watch.
#!/bin/bash
# Usage: run this script using the watch command; e.g.
# sudo watch ./setclock.sh
if [ -f "/tmp/clockset" ]; then
echo "Setting date";
date `cat /tmp/clockset`;
rm -f /tmp/clockset;
fi
@rcrichton
Copy link

We need to update this to restart the ntp service else ntpd get confused!

#!/bin/bash
# Usage: run this script using the watch command; e.g.
# sudo watch ./setclock.sh

if [ -f "/tmp/clockset" ]; then
  echo "Setting date";
    date `cat /tmp/clockset`;
    rm -f /tmp/clockset;
    sudo service ntp restart;
fi

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