File tree 4 files changed +43
-1
lines changed 4 files changed +43
-1
lines changed Original file line number Diff line number Diff line change @@ -4,6 +4,12 @@ install -D -m 0700 -o root sbin/firewall /srv/firewall/sbin/
4
4
install -D -m 0700 -o root libexec/* .py /srv/firewall/libexec/
5
5
install -D -m 0700 -o root init.d/firewall /etc/init.d/
6
6
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
+
7
13
cd packages/
8
14
python3 setup.py sdist
9
15
python3 setup.py install
Original file line number Diff line number Diff line change @@ -5,7 +5,7 @@ from optparse import OptionParser
5
5
import os ,sys ;
6
6
7
7
8
- parser = OptionParser (usage = "usage: %prog [options] start|stop|restart" )
8
+ parser = OptionParser (usage = "usage: %prog [options] start|stop|restart|status " )
9
9
10
10
def usage ():
11
11
parser .print_help ()
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
You can’t perform that action at this time.
0 commit comments