ICT-Infer / timelog

Time sheet time tracking
ISC License
1 stars 0 forks source link

Should timelog service only be advertised by Avahi when it is actually running? #20

Closed yarwelp closed 9 years ago

yarwelp commented 9 years ago

Currently, it will be advertised no matter whether or not it is actually running.

yarwelp commented 9 years ago

There's a relevant proposal in the Debian bug tracker: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=686294.

yarwelp commented 9 years ago
diff --git a/systemd-service/run.bash b/systemd-service/run.bash
index d58611d..7cfb791 100755
--- a/systemd-service/run.bash
+++ b/systemd-service/run.bash
@@ -2,4 +2,5 @@

 export HOME=/var/lib/timelog
 source ~/venv/bin/activate
-python3 ~/venv/serve/manage.py runserver 0.0.0.0:8000
+python3 ~/venv/serve/manage.py runserver 0.0.0.0:8000 &
+avahi-publish -s "timelog" _http._tcp 8000 "path=/timelog/"

will, under normal conditions, only be announcing the service when it is running. However;

  1. This will also announce that the service is available over IPv6. There is no way not to do that with avahi-publish, so if we are going to do it like this, issue #18 must be resolved first.
  2. Using Avahi must remain optional, so the above patch and the install script must be adapted so that the choice is honored.