📄 init.debian.sh
字号:
#!/bin/sh### BEGIN INIT INFO# Provides: shorewall# Required-Start: $network# Required-Stop: $network# Default-Start: S# Default-Stop: 0 6# Short-Description: Configure the firewall at boot time# Description: Configure the firewall according to the rules specified in# /etc/shorewall### END INIT INFOSRWL=/sbin/shorewallSRWL_OPTS="-tvv"WAIT_FOR_IFUP=/usr/share/shorewall/wait4ifup# Note, set INITLOG to /dev/null if you do not want to# keep logs of the firewall (not recommended)INITLOG=/var/log/shorewall-init.logtest -x $SRWL || exit 0test -x $WAIT_FOR_IFUP || exit 0test -n $INITLOG || { echo "INITLOG cannot be empty, please configure $0" ; exit 1;}if [ "$(id -u)" != "0" ]then echo "You must be root to start, stop or restart \"Shorewall firewall\"." exit 1fiecho_notdone () { if [ "$INITLOG" = "/dev/null" ] ; then echo "not done." else echo "not done (check $INITLOG)." fi}not_configured () { echo "#### WARNING ####" echo "The firewall won't be started/stopped unless it is configured" if [ "$1" != "stop" ] then echo "" echo "Please read about Debian specific customization in" echo "/usr/share/doc/shorewall-common/README.Debian.gz." fi echo "#################" exit 0}# check if shorewall is configured or notif [ -f "/etc/default/shorewall" ]then . /etc/default/shorewall SRWL_OPTS="$SRWL_OPTS $OPTIONS" if [ "$startup" != "1" ] then not_configured fielse not_configuredfi# wait for an unconfigured interface wait_for_pppd () { if [ "$wait_interface" != "" ] then for i in $wait_interface do $WAIT_FOR_IFUP $i 90 done fi}# start the firewallshorewall_start () { echo -n "Starting \"Shorewall firewall\": " wait_for_pppd $SRWL $SRWL_OPTS start >> $INITLOG 2>&1 && echo "done." || echo_notdone return 0}# stop the firewallshorewall_stop () { echo -n "Stopping \"Shorewall firewall\": " $SRWL $SRWL_OPTS clear >> $INITLOG 2>&1 && echo "done." || echo_notdone return 0}# restart the firewallshorewall_restart () { echo -n "Restarting \"Shorewall firewall\": " $SRWL $SRWL_OPTS restart >> $INITLOG 2>&1 && echo "done." || echo_notdone return 0}# refresh the firewallshorewall_refresh () { echo -n "Refreshing \"Shorewall firewall\": " $SRWL $SRWL_OPTS refresh >> $INITLOG 2>&1 && echo "done." || echo_notdone return 0}case "$1" in start) shorewall_start ;; stop) shorewall_stop ;; refresh) shorewall_refresh ;; force-reload|restart) shorewall_restart ;; *) echo "Usage: /etc/init.d/shorewall {start|stop|refresh|restart|force-reload}" exit 1esacexit 0
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -