1
0
Fork 0

Make some effort to see logs in supervisor.

This commit is contained in:
flabbergast 2014-09-01 22:29:18 +02:00
parent 4c0495ff9b
commit 42d37510b1
2 changed files with 20 additions and 5 deletions

View File

@ -4,27 +4,31 @@ username = admin
password = muflon
[program:gpsd]
command=/usr/sbin/gpsd -N -n -F /var/run/gpsd.sock -P /var/run/gpsd.pid /dev/ttyAMA0
command=/usr/sbin/gpsd -N -n -F /var/run/gpsd.sock -P /var/run/gpsd.pid /dev/ttyAMA0 -D 2
numprocs=1
priority=1
autostart=true
autorestart=true
redirect_stderr=true
[program:time-from-gps-oneshot]
command=/usr/bin/python /opt/gps-timekeep/time-from-gps/time-from-gps.py
command=/usr/bin/python -u /opt/gps-timekeep/time-from-gps/time-from-gps.py
directory=/opt/gps-timekeep/time-from-gps
numprocs=1
priority=2
autostart=true
autorestart=false
redirect_stderr=true
[program:gps-watcher]
command=/usr/bin/python /opt/gps-timekeep/watcher-daemon/gps-watcher.py
command=/usr/bin/python -u /opt/gps-timekeep/watcher-daemon/gps-watcher.py
directory=/opt/gps-timekeep/watcher-daemon
numprocs=1
priority=10
autostart=false
autorestart=true
redirect_stderr=true
stdout_logfile=/var/log/gps-watcher.log
[program:rpi_gpio_ntp]
command=/opt/gps-timekeep/bin/rpi_gpio_ntp -f -N 1 -g 18
@ -32,13 +36,16 @@ numprocs=1
priority=100
autostart=false
autorestart=false
redirect_stderr=true
[program:ntpd]
command=/usr/sbin/ntpd -n -c /opt/gps-timekeep/configs/ntp.conf -p /var/run/ntpd.pid -g -u 102:104
command=/usr/sbin/ntpd -n -c /opt/gps-timekeep/configs/ntp.conf -p /var/run/ntpd.pid -g -u 102:104 -l /var/log/ntpd.log
numprocs=1
priority=200
autostart=false
autorestart=false
redirect_stderr=true
stdout_logfile=/var/log/ntpd.log
[program:lighttpd]
command=/usr/sbin/lighttpd -D -f /opt/gps-timekeep/configs/lighttpd.conf
@ -46,3 +53,5 @@ numprocs=1
priority=300
autostart=true
autorestart=true
redirect_stderr=true
stdout_logfile=/var/log/lighttpd/error.log

View File

@ -15,6 +15,7 @@ import os
# declare global vars and constants
gpsd = None
gps_has_signal = None
gps_had_signal_last = None
ntpd_running = None
rpi_gpio_ntp_running = None
@ -77,7 +78,6 @@ def generate_html_file():
if os.path.isfile(SUPERVISOR_AUTH):
with open(SUPERVISOR_AUTH) as f:
supervisor_namepass = f.readline().strip() + "@"
print "is"
else:
supervisor_namepass = ""
@ -120,6 +120,8 @@ if __name__ == '__main__':
time.sleep(3) # wait for a few reports to come in, to get a possible fix
# so that we don't kill ntpd unnecessarily
print datetime.datetime.utcnow().isoformat('T') + ": started"
# main infinite loop
while True:
# does GPS have a fix?
@ -145,6 +147,10 @@ if __name__ == '__main__':
#os.system('clear')
#print gpsd
if gps_had_signal_last != gps_has_signal:
print datetime.datetime.utcnow().isoformat('T') + ": GPS fix changed. Currently? " + ("Yes" if gps_has_signal else "No")
gps_had_signal_last = gps_has_signal
# wait for X seconds until the next cycle
time.sleep(2)