# HG changeset patch # User Matti Hamalainen # Date 1687127585 -10800 # Node ID 72a3b687e6cebcb00607774f0629b06af2613b6e # Parent 28f3bf45d5d7e13853f1211949e967f592726283 Update mapsearch SysV init scripts. diff -r 28f3bf45d5d7 -r 72a3b687e6ce scripts/mapsearch.sysvinit --- a/scripts/mapsearch.sysvinit Mon Jun 19 01:05:28 2023 +0300 +++ b/scripts/mapsearch.sysvinit Mon Jun 19 01:33:05 2023 +0300 @@ -46,6 +46,7 @@ THLIBS_DIR="${MAPSEARCH_DIR}/th-libs/" + update_map_data() { if test ! -d "$MAPSEARCH_DIR/.hg"; then @@ -66,93 +67,84 @@ } -MAPSEARCH_ARGS="" -for SPEC in ${MAPSEARCH_MAPLIST}; do - MAP=$(echo "$SPEC"|cut -d : -f 1) - WXC=$(echo "$SPEC"|cut -d : -f 2) - WYC=$(echo "$SPEC"|cut -d : -f 3) - MAPSEARCH_ARGS="$MAPSEARCH_ARGS ${MAPSEARCH_DIR}/world/${MAP}.map:${MAPSEARCH_DIR}/world/${MAP}.loc:${MAP}:$WXC:$WYC" -done - - -#export PATH="${PATH:+$PATH:}/usr/sbin:/sbin" - case "$1" in start) - update_map_data - log_daemon_msg "Starting PupuMaps map search server" "mapsearch" || true - 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 - log_end_msg 1 || true - fi - ;; + update_daemon + update_map_data + log_daemon_msg "Starting PupuMaps map search server" "mapsearch" || true + 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 + log_end_msg 1 || true + fi + ;; + stop) - log_daemon_msg "Stopping PupuMaps map search server" "mapsearch" || true - if start-stop-daemon --stop --quiet --oknodo --remove-pidfile --pidfile "$MAPSEARCH_PIDFILE"; then - log_end_msg 0 || true - else - log_end_msg 1 || true - fi - ;; + log_daemon_msg "Stopping PupuMaps map search server" "mapsearch" || true + if start-stop-daemon --stop --quiet --oknodo --remove-pidfile --pidfile "$MAPSEARCH_PIDFILE"; then + log_end_msg 0 || true + else + log_end_msg 1 || true + fi + ;; reload|force-reload) - update_map_data - log_daemon_msg "Reloading PupuMaps map search server's configuration" "mapsearch" || true - if start-stop-daemon --stop --signal 1 --quiet --oknodo --remove-pidfile --pidfile "$MAPSEARCH_PIDFILE" --exec "$MAPSEARCH_BIN"; then - log_end_msg 0 || true - else - log_end_msg 1 || true - fi - ;; + update_map_data + log_daemon_msg "Reloading PupuMaps map search server's configuration" "mapsearch" || true + if start-stop-daemon --stop --signal 1 --quiet --oknodo --remove-pidfile --pidfile "$MAPSEARCH_PIDFILE" --exec "$MAPSEARCH_BIN"; then + log_end_msg 0 || true + else + log_end_msg 1 || true + fi + ;; restart) - 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 - log_end_msg 1 || true - fi - ;; + log_daemon_msg "Restarting PupuMaps map search server" "mapsearch" || true + start-stop-daemon --stop --quiet --oknodo --retry 30 --remove-pidfile --pidfile "$MAPSEARCH_PIDFILE" + update_map_data + 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 + log_end_msg 1 || true + fi + ;; try-restart) - update_map_data - 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 - 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 - log_end_msg 1 || true - fi - ;; - 1) - # daemon not running - log_progress_msg "(not running)" || true - log_end_msg 0 || true - ;; - *) - # failed to stop - log_progress_msg "(failed to stop)" || true - log_end_msg 1 || true - ;; - esac - ;; + 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_map_data + update_daemon + case $RET in + 0) + # old daemon stopped + 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 + log_end_msg 1 || true + fi + ;; + 1) + # daemon not running + log_progress_msg "(not running)" || true + log_end_msg 0 || true + ;; + *) + # failed to stop + log_progress_msg "(failed to stop)" || true + log_end_msg 1 || true + ;; + esac + ;; status) - status_of_proc -p "$MAPSEARCH_PIDFILE" "$MAPSEARCH_BIN" mapsearch && exit 0 || exit $? - ;; + status_of_proc -p "$MAPSEARCH_PIDFILE" "$MAPSEARCH_BIN" mapsearch && exit 0 || exit $? + ;; *) - log_action_msg "Usage: /etc/init.d/mapsearch {start|stop|reload|force-reload|restart|try-restart|status}" || true - exit 1 + log_action_msg "Usage: /etc/init.d/mapsearch {start|stop|reload|force-reload|restart|try-restart|status}" || true + exit 1 esac exit 0 diff -r 28f3bf45d5d7 -r 72a3b687e6ce scripts/mapsearch.sysvinit.cfg --- a/scripts/mapsearch.sysvinit.cfg Mon Jun 19 01:05:28 2023 +0300 +++ b/scripts/mapsearch.sysvinit.cfg Mon Jun 19 01:33:05 2023 +0300 @@ -26,8 +26,14 @@ #MAPSEARCH_PIDFILE="/var/run/mapsearch.pid" -# Set world center / origin -MAPSEARCH_OPTS="$MAPSEARCH_OPTS -w 8192:8192" - -# List of maps with offsets to world origin -MAPSEARCH_MAPLIST="laenor:1:1 rothikgen:1311:-1255 lucentium:-634:2345 furnachia:1211:1155 desolathya:-1210:820 renardy:2070:-910" +# Set world center / origin and maps +MAPSEARCH_OPTS="$MAPSEARCH_OPTS + -D ${MAPSEARCH_DIR}/world/ + -w 8192:8192 + laenor.map:laenor.loc:laenor:1:1 + rothikgen.map:rothikgen.loc:rothikgen:1311:-1255 + lucentium.map:lucentium.loc:lucentium:-634:2345 + furnachia.map:furnachia.loc:furnachia:1211:1155 + desolathya.map:desolathya.loc:desolathya:-1210:820 + renardy.map:renardy.loc:renardy:2070:-910 +"