2021-03-04 14:30:38 +03:00
|
|
|
#!/bin/sh
|
|
|
|
### BEGIN INIT INFO
|
|
|
|
# Provides: zapret
|
|
|
|
# Required-Start: $local_fs $network
|
|
|
|
# Required-Stop: $local_fs $network
|
|
|
|
# Default-Start: 2 3 4 5
|
|
|
|
# Default-Stop: 0 1 6
|
|
|
|
### END INIT INFO
|
|
|
|
|
|
|
|
SCRIPT=$(readlink -f "$0")
|
|
|
|
EXEDIR=$(dirname "$SCRIPT")
|
|
|
|
ZAPRET_BASE=$(readlink -f "$EXEDIR/../..")
|
|
|
|
. "$EXEDIR/functions"
|
|
|
|
|
|
|
|
NAME=zapret
|
|
|
|
DESC=anti-zapret
|
|
|
|
|
2021-11-06 10:56:15 +03:00
|
|
|
do_start()
|
|
|
|
{
|
|
|
|
zapret_run_daemons
|
2022-02-15 17:15:36 +03:00
|
|
|
[ "$INIT_APPLY_FW" != "1" ] || { zapret_apply_firewall; }
|
2021-11-06 10:56:15 +03:00
|
|
|
}
|
|
|
|
do_stop()
|
|
|
|
{
|
|
|
|
zapret_stop_daemons
|
|
|
|
[ "$INIT_APPLY_FW" != "1" ] || zapret_unapply_firewall
|
|
|
|
}
|
|
|
|
|
2021-03-04 14:30:38 +03:00
|
|
|
case "$1" in
|
|
|
|
start)
|
2021-11-06 10:56:15 +03:00
|
|
|
do_start
|
2021-03-04 14:30:38 +03:00
|
|
|
;;
|
|
|
|
|
|
|
|
stop)
|
2021-11-06 10:56:15 +03:00
|
|
|
do_stop
|
|
|
|
;;
|
|
|
|
|
|
|
|
restart)
|
|
|
|
do_stop
|
|
|
|
do_start
|
2021-03-04 14:30:38 +03:00
|
|
|
;;
|
|
|
|
|
2022-02-15 17:15:36 +03:00
|
|
|
start-fw|start_fw)
|
2021-03-04 14:30:38 +03:00
|
|
|
zapret_apply_firewall
|
|
|
|
;;
|
2022-02-15 17:15:36 +03:00
|
|
|
stop-fw|stop_fw)
|
2021-03-04 14:30:38 +03:00
|
|
|
zapret_unapply_firewall
|
|
|
|
;;
|
2021-11-06 10:56:15 +03:00
|
|
|
|
2022-02-15 17:15:36 +03:00
|
|
|
restart-fw|restart_fw)
|
2021-11-06 10:56:15 +03:00
|
|
|
zapret_unapply_firewall
|
|
|
|
zapret_apply_firewall
|
|
|
|
;;
|
2021-03-04 14:30:38 +03:00
|
|
|
|
2022-02-15 17:15:36 +03:00
|
|
|
start-daemons|start_daemons)
|
2021-03-04 14:30:38 +03:00
|
|
|
zapret_run_daemons
|
|
|
|
;;
|
2022-02-15 17:15:36 +03:00
|
|
|
stop-daemons|stop_daemons)
|
2021-03-04 14:30:38 +03:00
|
|
|
zapret_stop_daemons
|
|
|
|
;;
|
2022-02-15 17:15:36 +03:00
|
|
|
restart-daemons|restart_daemons)
|
2021-11-06 10:56:15 +03:00
|
|
|
zapret_stop_daemons
|
|
|
|
zapret_run_daemons
|
|
|
|
;;
|
2022-02-15 17:15:36 +03:00
|
|
|
|
|
|
|
reload-ifsets|reload_ifsets)
|
|
|
|
zapret_reload_ifsets
|
|
|
|
;;
|
|
|
|
list-ifsets|list_ifsets)
|
|
|
|
zapret_list_ifsets
|
|
|
|
;;
|
|
|
|
list-table|list_table)
|
|
|
|
zapret_list_table
|
|
|
|
;;
|
2021-03-04 14:30:38 +03:00
|
|
|
|
|
|
|
*)
|
|
|
|
N=/etc/init.d/$NAME
|
2022-02-15 17:15:36 +03:00
|
|
|
echo "Usage: $N {start|stop|restart|start-fw|stop-fw|restart-fw|start-daemons|stop-daemons|restart-daemons|reload-ifsets|list-ifsets|list-table}" >&2
|
2021-03-04 14:30:38 +03:00
|
|
|
exit 1
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
|
|
|
exit 0
|