Created
January 26, 2018 15:18
Example: Synchronize time of Dahua ip camera
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
/usr/bin/timedatectl status | /usr/bin/grep "synchronized: yes" >/dev/null 2>&1 | |
if [ 0 -ne $? ] | |
then | |
exit 1 | |
fi | |
now=`/usr/bin/date "+%F%%20%T" 2>/dev/null` | |
if [ 0 -ne $? ] | |
then | |
exit 1 | |
fi | |
# Replace USER and PASSWORD | |
/usr/bin/curl --digest "http://USER:PASSWORD@192.168.0.10/cgi-bin/global.cgi?action=setCurrentTime&time=$now" </dev/null >/dev/null 2>&1 | |
/usr/bin/curl --digest "http://USER:PASSWORD@192.168.0.11/cgi-bin/global.cgi?action=setCurrentTime&time=$now" </dev/null >/dev/null 2>&1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment