Repost: Automatic Route Refresh
Hi HH,
no reaction on this since 9 months:
The "manual route update" on dashboard is still a pain in the ... . It would be such a relief to have this automated.
Thanks, Andreas
-
Request is over 2 years old…
https://support.hammerhead.io/hc/en-us/community/posts/1260801698630-Trigger-route-sync-from-Device
-
That’s a great idea. Unfortunately it doesn’t solve the problem for me because I almost never use routes in the first place if I start the ride at home (i.e. turn the Karoo on within reach of my home wifi), but I guess I could just as well trigger the route refresh always once every few hours during the daytime. Now how do I do the refresh from a crontab with wget (or whatever)...?
-
Use this script in crontab::
https://gist.github.com/spoetnik/ebeb9b6a62601643e5f25bc351fb47f7 -
That’s perfect, thank you so much! For now I have it running 5 times per day, will change to hourly if it turns out that is not frequent enough. (I would hope that I can remember to do the refresh manually if I am actually planning a route right before the ride, but usually it’s with routes I’ve planned the night before (or earlier) that I forget it.)
-
I have an always-on Linux machine (that I primarily use for watching tv...) so I just used cron (a system for running commands automatically on a predefined schedule) on it to run Martijn’s script (with appropriate modifications). Cron is available on macOS as well if you’re comfortable with using the command line, no idea how you would do the same on Windows.
-
I think jq is not installed on very minimal versions of linux, like on your raspberry PI
Maybe these instructions could help you install jq, and let you have a working update script: https://lindevs.com/install-jq-on-raspberry-pi
jq is a little commandline tool to process the JSON response from the hammerhead dashboard
-
I updated my script, and added the ' -s' option to the curl-command.
And cleaned up some double code
https://gist.github.com/spoetnik/ebeb9b6a62601643e5f25bc351fb47f7
-
My version is jq-1.6, no idea if that makes a difference though... Other than that, my first bet would be a typo (or equivalent such as copy-paste corruption or download conversion error) somewhere in the script. Guess you’ll just have to debug the script yourself, I’d add lines like echo $token after each variable assignment to see exactly where it goes wrong. (Just don’t post the output here.)
-
My script is no longer needed!!
https://support.hammerhead.io/hc/en-us/community/posts/1260801698630/comments/15745404149531
Please sign in to leave a comment.
Comments
15 comments