mirror of
https://github.com/gtxaspec/wz_mini_hacks.git
synced 2024-12-23 12:43:35 +00:00
Run a NTP client at startup (#301)
* Added NTP service to startup A NTP service script will run a NTP client on a custom NTP server in order to synchronize the camera's clock. This may be useful in cases where the camera has to use a local NTP server rather than the one hard coded in iCamera. To use this, simply set your desired NTP server in the `NTP_SERVER` option in `wz_mini.conf`. * Kill timesync if a custom NTP server is used When using a custom NTP server, the timesync service with its hard-coded NTP servers should not be running.
This commit is contained in:
parent
10dba022a5
commit
b7c27c73bd
26
SD_ROOT/wz_mini/etc/init.d/S18ntp
Normal file
26
SD_ROOT/wz_mini/etc/init.d/S18ntp
Normal file
@ -0,0 +1,26 @@
|
||||
#!/bin/sh
|
||||
### BEGIN INIT INFO
|
||||
# Provides:
|
||||
# Short-Description: Starts ntpd against a custom NTP server
|
||||
# Description: The clock will synchronize against a user defined NTP server. Useful if the camera is on an isolated network.
|
||||
### END INIT INFO
|
||||
|
||||
. /opt/wz_mini/wz_mini.conf
|
||||
|
||||
case "$1" in
|
||||
start)
|
||||
|
||||
echo "#####$(basename "$0")#####"
|
||||
|
||||
if [ ! -z "$NTP_SERVER" ] ; then
|
||||
# Slight delay required so that we can kill timesync from interfering
|
||||
(sleep 30 && kill -9 $(pgrep -f timesync) ; /opt/wz_mini/tmp/.bin/ntpd -p "$NTP_SERVER") &
|
||||
fi
|
||||
|
||||
;;
|
||||
*)
|
||||
echo "Usage: $0 {start}"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
@ -36,6 +36,8 @@ ENABLE_NFSv4="false"
|
||||
ENABLE_RTL8189FS_DRIVER="true"
|
||||
ENABLE_ATBM603X_DRIVER="true"
|
||||
|
||||
NTP_SERVER=
|
||||
|
||||
##### NETWORK INTERFACE BONDING #####
|
||||
BONDING_ENABLED="false"
|
||||
BONDING_PRIMARY_INTERFACE="eth0"
|
||||
|
@ -36,6 +36,8 @@ ENABLE_NFSv4="false"
|
||||
ENABLE_RTL8189FS_DRIVER="true"
|
||||
ENABLE_ATBM603X_DRIVER="true"
|
||||
|
||||
NTP_SERVER=
|
||||
|
||||
##### NETWORK INTERFACE BONDING #####
|
||||
BONDING_ENABLED="false"
|
||||
BONDING_PRIMARY_INTERFACE="eth0"
|
||||
|
Loading…
Reference in New Issue
Block a user