Skip to content

Commit

Permalink
add NTP update script
Browse files Browse the repository at this point in the history
  • Loading branch information
glynhudson committed Apr 20, 2017
1 parent 2b0fad3 commit 0081b6d
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 2 deletions.
10 changes: 10 additions & 0 deletions ntp_update.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/bin/bash

# Force NTP time update

rpi-rw
sudo service ntp stop
sudo ntpd -q -g
sudo service ntp start
rpi-ro

7 changes: 5 additions & 2 deletions rc.local_jessieminimal
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
if ( mount | grep "on /var/log "| grep -q "^tmpfs " )
then
for i in "redis" "apache2" "mysql" "openhab" "logrotate" "mosquitto"; do mkdir /var/log/"$i"; done
for i in "emoncms.log" "mysql.log" "mqtt_input.log" "redis/redis-server.log" "service-runner.log" "mysql/error.log" "apache2/error.log" ; do touch /var/log/"$i"; done
for i in "emoncms.log" "mysql.log" "mqtt_input.log" "redis/redis-server.log" "service-runner.log" "mysql/error.log" "apache2/error.log" ; do ""chmod 666"" /var/log/"$i"; done
for i in "emoncms.log" "mysql.log" "mqtt_input.log" "redis/redis-server.log" "service-runner.log" "mysql/error.log" "apache2/error.log" "ntp_update.log"; do touch /var/log/"$i"; done
for i in "emoncms.log" "mysql.log" "mqtt_input.log" "redis/redis-server.log" "service-runner.log" "mysql/error.log" "apache2/error.log" "ntp_update.log"; do ""chmod 666"" /var/log/"$i"; done
chown -R root:adm /var/log/apache2
chown -R redis:redis /var/log/redis
chown -R mysql:adm /var/log/mysql
Expand All @@ -34,4 +34,7 @@ sleep 5
service mqtt_input restart
service lwrfd restart

## Start Wifi AP (uncomment if required) see emonpi/wifiAP/readme.md
# /home/pi/emonpi/wifiAP/wifiAP.sh start

exit 0
5 changes: 5 additions & 0 deletions sudo_crontab
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,8 @@ MAILTO=""

# Check wifi is connecrted very 5 min
*/5 * * * * /usr/local/bin/wifi-check > /home/pi/data/wificheck.log 2>&1

# Force NTP update every 1 hour

0 * * * * /home/pi/emonpi/ntp_update.sh >> /var/log/ntp_update.log 2>&1

0 comments on commit 0081b6d

Please sign in to comment.