Skip to content

Commit 7e7ffa7

Browse files
committed
systemd/firewall.service
1 parent 7b844d9 commit 7e7ffa7

File tree

4 files changed

+43
-1
lines changed

4 files changed

+43
-1
lines changed

install.sh

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,12 @@ install -D -m 0700 -o root sbin/firewall /srv/firewall/sbin/
44
install -D -m 0700 -o root libexec/*.py /srv/firewall/libexec/
55
install -D -m 0700 -o root init.d/firewall /etc/init.d/
66

7+
install -D -m 0700 -o root systemd/system/firewall.service /usr/lib/systemd/system/
8+
install -D -m 0700 -o root systemd/system/firewall /etc/sysconfig/
9+
10+
systemctl enable firewall
11+
systemctl start firewall
12+
713
cd packages/
814
python3 setup.py sdist
915
python3 setup.py install

sbin/firewall

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ from optparse import OptionParser
55
import os,sys;
66

77

8-
parser = OptionParser(usage = "usage: %prog [options] start|stop|restart")
8+
parser = OptionParser(usage = "usage: %prog [options] start|stop|restart|status")
99

1010
def usage():
1111
parser.print_help()

systemd/firewall

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
##############################################
2+
NAME=firewall
3+
BASEDIR='/srv/firewall'
4+
PROG=$BASEDIR/sbin/$NAME
5+
LOGFILE=/var/tmp/$NAME.log
6+
PIDFILE=/var/tmp/$NAME.pid
7+
##############################################
8+
LIBEXEC=$BASEDIR/libexec
9+
RULE=www

systemd/firewall.service

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
####################################################
2+
# Homepage: http://www.netkiller.cn
3+
# Author: netkiller<[email protected]>
4+
# Script: https://github.com/oscm/shell
5+
# Date: 2015-11-03
6+
####################################################
7+
8+
[Unit]
9+
Description=Netkiller Firwall
10+
After=network.target
11+
After=syslog.target
12+
13+
[Service]
14+
Type=forking
15+
16+
User=root
17+
Group=root
18+
19+
EnvironmentFile=/etc/sysconfig/firewall
20+
ExecStartPre="systemctl stop firewalld"
21+
ExecStart=/srv/firewall/sbin/firewall --libexec=${LIBEXEC} --rule=${RULE} start
22+
ExecStartPost="systemctl disable firewalld"
23+
24+
ExecStop=/srv/firewall/sbin/firewall --libexec=${LIBEXEC} --rule=${RULE} stop
25+
26+
[Install]
27+
WantedBy=multi-user.target

0 commit comments

Comments
 (0)