Skip to content

Instantly share code, notes, and snippets.

@heisvoid
Created January 26, 2018 15:18
Example: Synchronize time of Dahua ip camera
/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