changeset 2103:7709aeda1b2f

More fixes to mapsearch SysV init script.
author Matti Hamalainen <ccr@tnsp.org>
date Tue, 10 Sep 2019 16:35:07 +0300
parents 861137feb73c
children 425e8a4d2530
files scripts/mapsearch.sysvinit
diffstat 1 files changed, 12 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/scripts/mapsearch.sysvinit	Tue Sep 10 16:31:05 2019 +0300
+++ b/scripts/mapsearch.sysvinit	Tue Sep 10 16:35:07 2019 +0300
@@ -50,17 +50,22 @@
 {
   if test ! -d "$MAPSEARCH_DIR/.hg"; then
     hg clone "$MAPSEARCH_REPO" "$MAPSEARCH_DIR"
-    if test ! -d "$THLIBS_DIR/.hg"; then
-      hg clone "$THLIBS_REPO" "$THLIBS_DIR"
-    fi
   else
     cd "$MAPSEARCH_DIR" && hg pull && hg update
-    cd "$THLIBS_DIR" && hg pull && hg update
-    cd "$MAPSEARCH_DIR" && make "bin/mapsearch" -j4 && cp "bin/mapsearch" "$MAPSEARCH_BIN"
   fi
 }
 
 
+update_daemon()
+{
+  if test ! -d "$THLIBS_DIR/.hg"; then
+    hg clone "$THLIBS_REPO" "$THLIBS_DIR"
+  fi
+  cd "$THLIBS_DIR" && hg pull && hg update
+  cd "$MAPSEARCH_DIR" && make "bin/mapsearch" -j4 && cp "bin/mapsearch" "$MAPSEARCH_BIN"
+}
+
+
 MAPSEARCH_ARGS=""
 for SPEC in ${MAPSEARCH_MAPLIST}; do
   MAP=$(echo "$SPEC"|cut -d : -f 1)
@@ -105,6 +110,7 @@
   	update_map_data
 	log_daemon_msg "Restarting PupuMaps map search server" "mapsearch" || true
 	start-stop-daemon --stop --quiet --oknodo --retry 30 --remove-pidfile --pidfile "$MAPSEARCH_PIDFILE"
+  	update_daemon
 	if start-stop-daemon --start --quiet --oknodo -m --background --pidfile "$MAPSEARCH_PIDFILE" --exec "$MAPSEARCH_BIN" -- $MAPSEARCH_ARGS $MAPSEARCH_OPTS; then
 	    log_end_msg 0 || true
 	else
@@ -117,6 +123,7 @@
 	log_daemon_msg "Restarting PupuMaps map search server" "mapsearch" || true
 	RET=0
 	start-stop-daemon --stop --quiet --retry 30 --remove-pidfile --pidfile "$MAPSEARCH_PIDFILE" || RET="$?"
+  	update_daemon
 	case $RET in
 	    0)
 		# old daemon stopped