From fe01f520a9256515d2e56f741c0c4d0bd475e895 Mon Sep 17 00:00:00 2001 From: bol-van Date: Sat, 6 Nov 2021 10:56:15 +0300 Subject: [PATCH] init.d: sysv restart commands --- init.d/sysv/zapret | 33 ++++++++++++++++++++++++++++----- 1 file changed, 28 insertions(+), 5 deletions(-) diff --git a/init.d/sysv/zapret b/init.d/sysv/zapret index 0691bba..5f65558 100755 --- a/init.d/sysv/zapret +++ b/init.d/sysv/zapret @@ -15,15 +15,29 @@ ZAPRET_BASE=$(readlink -f "$EXEDIR/../..") NAME=zapret DESC=anti-zapret +do_start() +{ + zapret_run_daemons + [ "$INIT_APPLY_FW" != "1" ] || zapret_apply_firewall +} +do_stop() +{ + zapret_stop_daemons + [ "$INIT_APPLY_FW" != "1" ] || zapret_unapply_firewall +} + case "$1" in start) - zapret_run_daemons - [ "$INIT_APPLY_FW" != "1" ] || zapret_apply_firewall + do_start ;; stop) - zapret_stop_daemons - [ "$INIT_APPLY_FW" != "1" ] || zapret_unapply_firewall + do_stop + ;; + + restart) + do_stop + do_start ;; start-fw) @@ -32,6 +46,11 @@ case "$1" in stop-fw) zapret_unapply_firewall ;; + + restart-fw) + zapret_unapply_firewall + zapret_apply_firewall + ;; start-daemons) zapret_run_daemons @@ -39,10 +58,14 @@ case "$1" in stop-daemons) zapret_stop_daemons ;; + restart-daemons) + zapret_stop_daemons + zapret_run_daemons + ;; *) N=/etc/init.d/$NAME - echo "Usage: $N {start|stop|start-fw|stop-fw|start-daemons|stop-daemons}" >&2 + echo "Usage: $N {start|stop|restart|start-fw|stop-fw|restart-fw|start-daemons|stop-daemons|restart-daemons}" >&2 exit 1 ;; esac