Add init script
This commit is contained in:
parent
7c6a3f4c0f
commit
34cb6b6ad2
1 changed files with 37 additions and 0 deletions
37
files/nftables-init
Executable file
37
files/nftables-init
Executable file
|
|
@ -0,0 +1,37 @@
|
|||
#!/bin/sh
|
||||
# Nico Schottelius, nico.schottelius at ungleich.ch
|
||||
# 2017-07-01
|
||||
### BEGIN INIT INFO
|
||||
# Provides: nftables
|
||||
# Required-Start:
|
||||
# Required-Stop:
|
||||
# Should-Start:
|
||||
# Should-Stop:
|
||||
# Default-Start: 2 3 4 5
|
||||
# Default-Stop: 0 1 6
|
||||
# Short-Description: nftable rules
|
||||
### END INIT INFO
|
||||
|
||||
|
||||
|
||||
CONF=/etc/nftables.conf
|
||||
BIN=/usr/sbin/nft
|
||||
|
||||
[ -x "$BIN" ] || exit 0
|
||||
|
||||
case "$1" in
|
||||
start)
|
||||
$BIN flush ruleset
|
||||
$BIN -f $CONF
|
||||
;;
|
||||
restart)
|
||||
$0 stop && $0 start
|
||||
;;
|
||||
stop)
|
||||
$BIN flush ruleset
|
||||
;;
|
||||
*)
|
||||
echo "Usage: $SCRIPTNAME {start|stop|restart}" >&2
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
Loading…
Add table
Add a link
Reference in a new issue