mirror of
https://github.com/bol-van/zapret.git
synced 2024-12-22 22:35:54 +00:00
84 lines
1.3 KiB
Bash
Executable File
84 lines
1.3 KiB
Bash
Executable File
#!/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
|
|
|
|
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)
|
|
do_start
|
|
;;
|
|
|
|
stop)
|
|
do_stop
|
|
;;
|
|
|
|
restart)
|
|
do_stop
|
|
do_start
|
|
;;
|
|
|
|
start-fw|start_fw)
|
|
zapret_apply_firewall
|
|
;;
|
|
stop-fw|stop_fw)
|
|
zapret_unapply_firewall
|
|
;;
|
|
|
|
restart-fw|restart_fw)
|
|
zapret_unapply_firewall
|
|
zapret_apply_firewall
|
|
;;
|
|
|
|
start-daemons|start_daemons)
|
|
zapret_run_daemons
|
|
;;
|
|
stop-daemons|stop_daemons)
|
|
zapret_stop_daemons
|
|
;;
|
|
restart-daemons|restart_daemons)
|
|
zapret_stop_daemons
|
|
zapret_run_daemons
|
|
;;
|
|
|
|
reload-ifsets|reload_ifsets)
|
|
zapret_reload_ifsets
|
|
;;
|
|
list-ifsets|list_ifsets)
|
|
zapret_list_ifsets
|
|
;;
|
|
list-table|list_table)
|
|
zapret_list_table
|
|
;;
|
|
|
|
*)
|
|
N=/etc/init.d/$NAME
|
|
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
|
|
exit 1
|
|
;;
|
|
esac
|
|
|
|
exit 0
|