All pastes #1895386 Raw Edit

dpecka

public text v1 · immutable
#1895386 ·published 2010-07-06 08:29 UTC
rendered paste body
#!/bin/bash## /etc/init.d/myFW#   and its symbolic link# /usr/sbin/rcmyFW#### BEGIN INIT INFO# Provides:          myFW# Required-Start:    $ALL# Required-Stop:     $network# Default-Start:     3 5# Default-Stop:      0 1 2 6# Description:       myFW provides a routing and firewall### END INIT INFOmyFW_script=/usr/sbin/myFW;start_fw() {	$myFW_script;	exit 0;};stop_fw() {	echo "clearing rules ..";	iptables -F;	iptables -t nat -F;	iptables -X;	exit 0;};status_fw() {	iptables -L;	iptables -t nat -L;	exit 0;};## if passed some parametr, it definitely ran by userif [ ! -z $1 ]; then	case $1 in		start) start_fw;;		stop) stop_fw;;		status) status_fw;;		*) echo "use one of start, stop or status"; exit=1;;	esac;	exit 0;fi## if not, it's run by init, so:## determines if we're in startmode (^S) or killmode (^K)mode=$(echo $0 | sed 's@^.*/\(.\).*$@\1@');case $mode in	S) start_fw;;	K) stop_fw;;	*) echo "interesting, something weird has happened, check runlevel links .."; exit 1;;esac;## weird-endecho "it should never print this ..";exit 99;