Commit 5bcb7fd9 authored by Kevin Abel's avatar Kevin Abel
Browse files

Merge branch 'bus-daemon' into 'master'

Add a Bus Daemon

This is helpful for when the server is under heavy load to ensure that the script is only ever ran once every second.
If you use this daemon, be sure that busproxy.php is aliased in apache to serve bus.json.
parents ead55a5c ac6c35ac
description "maps.unl.edu bus location proxy"
author "mfairchild365@gmail.com"
# used to be: start on startup
# until we found some mounts weren't ready yet while booting:
start on runlevel [2345]
stop on runlevel [06]
# Automatically Respawn:
respawn
respawn limit 15 5
script
#configure the path
exec while true; do php /var/www/html/maps/www/busproxy.php; sleep 1; done
end script
post-start script
# Optionally put a script here that will notify you node has (re)started
end script
\ No newline at end of file
<?php
$url = 'http://getonboard.lincoln.ne.gov/packet/json/vehicle?lastVehicleHttpRequestTime=0';
$file = 'bus.json';
$file = __DIR__ . '/bus.json';
$seconds_to_cache = 1;
if (!file_exists($file) || time() - $seconds_to_cache >= filemtime($file)) {
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment