google / transitfeed

A Python library for reading, validating, and writing transit schedule information in the GTFS format.
https://github.com/google/transitfeed/wiki
Apache License 2.0
679 stars 254 forks source link

[FR] Automate Initialization of Schedule Viewer #450

Closed russellhoff closed 6 years ago

russellhoff commented 6 years ago

First of all thanks for your work.

They are really helpful. Anyway, I want to keep Schedule Viewer always running and whenever it stops (for whatsoever reason), rerun it.

Being under a Linux OS, I know using Cron so that I can automate initialization of scripts. However, how to maintain a long running script running and restart it whenever it stops/fails something?

For the time being, I've written a very short bash script (arrancar.sh) to start Schedule Viewer with a gtfs feed:

#!/bin/bash

schedule_viewer.py --key XXXXXXXXXXXXXXXXX --feed_filename /home/user/ver-gtfs/gtfs.zip --port 8767

And to start, I type the following: $ sh arrancar.sh >> /home/user/ver-gtfs/$(date +\%Y-\%m-\%d_\%H-\%M-\%S).txt 2>&1 &

laidig commented 6 years ago

If you're using Ubuntu (or many other modern flavors of Linux) look into running as a service via systemd: https://www.digitalocean.com/community/tutorials/how-to-use-systemctl-to-manage-systemd-services-and-units