mirror of
https://github.com/bol-van/zapret.git
synced 2024-11-27 04:30:53 +03:00
74 lines
1.1 KiB
Bash
Executable File
74 lines
1.1 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)
|
|
zapret_apply_firewall
|
|
;;
|
|
stop-fw)
|
|
zapret_unapply_firewall
|
|
;;
|
|
|
|
restart-fw)
|
|
zapret_unapply_firewall
|
|
zapret_apply_firewall
|
|
;;
|
|
|
|
start-daemons)
|
|
zapret_run_daemons
|
|
;;
|
|
stop-daemons)
|
|
zapret_stop_daemons
|
|
;;
|
|
restart-daemons)
|
|
zapret_stop_daemons
|
|
zapret_run_daemons
|
|
;;
|
|
|
|
*)
|
|
N=/etc/init.d/$NAME
|
|
echo "Usage: $N {start|stop|restart|start-fw|stop-fw|restart-fw|start-daemons|stop-daemons|restart-daemons}" >&2
|
|
exit 1
|
|
;;
|
|
esac
|
|
|
|
exit 0
|