Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
U
UNL_TourMap
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Ryan Dee
UNL_TourMap
Commits
caff375e
Commit
caff375e
authored
10 years ago
by
Michael Fairchild
Browse files
Options
Downloads
Patches
Plain Diff
Implement a bus daemon
parent
f21ec861
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
scripts/bus-daemon-upstart.conf
+16
-0
16 additions, 0 deletions
scripts/bus-daemon-upstart.conf
scripts/bus-daemon.php
+14
-0
14 additions, 0 deletions
scripts/bus-daemon.php
www/busproxy.php
+1
-1
1 addition, 1 deletion
www/busproxy.php
with
31 additions
and
1 deletion
scripts/bus-daemon-upstart.conf
0 → 100644
+
16
−
0
View file @
caff375e
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
php
/
var
/
www
/
html
/
scripts
/
bus
-
daemon
.
php
>> /
var
/
log
/
bus_daemon
.
log
2
>&
1
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
This diff is collapsed.
Click to expand it.
scripts/bus-daemon.php
0 → 100644
+
14
−
0
View file @
caff375e
<?php
/**
* This daemon runs the bus proxy script every second to generate the json file.
* 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.
*/
$project_root
=
dirname
(
__DIR__
);
while
(
true
)
{
$result
=
shell_exec
(
"php
$project_root
/www/busproxy.php"
);
sleep
(
1
);
}
This diff is collapsed.
Click to expand it.
www/busproxy.php
+
1
−
1
View file @
caff375e
<?php
$url
=
'http://getonboard.lincoln.ne.gov/packet/json/vehicle?routes=138,139&lastVehicleHttpRequestTime=0'
;
$file
=
'
bus.json'
;
$file
=
__DIR__
.
'/
bus.json'
;
$seconds_to_cache
=
1
;
if
(
!
file_exists
(
$file
)
||
time
()
-
$seconds_to_cache
>=
filemtime
(
$file
))
{
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment