]> git.pld-linux.org Git - packages/ipset.git/blame - ipset.init
- adapterized, init script updated.
[packages/ipset.git] / ipset.init
CommitLineData
3a06e9e7
PS
1#!/bin/sh
2
3# chkconfig: 2345 07 93
4# description: Automates administration of IP sets.
5# config: /etc/sysconfig/ipset
6
7IPSET_CONFIG=/etc/sysconfig/ipset
8if [ ! -f $IPSET_CONFIG ]; then
9 case "$1" in
10 start|restart|force-reload)
11 exit 0
12 ;;
13 esac
14fi
15
16. /etc/rc.d/init.d/functions
17
18start() {
19 if [ -f $IPSET_CONFIG ]; then
20 show "Applying ipset rules"
b1b044b0
PS
21 /usr/sbin/ipset -X
22 /usr/sbin/ipset -R < $IPSET_CONFIG && ok || fail
3a06e9e7
PS
23 touch /var/lock/subsys/ipset
24 fi
25}
26
27stop() {
28 show "Resetting ipset rules"
29 /usr/sbin/ipset -X && ok || fail
30 rm -f /var/lock/subsys/ipset
31}
32
33case "$1" in
34 start)
35 start
b1b044b0 36 exit $?
3a06e9e7
PS
37 ;;
38 stop)
39 stop
b1b044b0 40 exit $?
3a06e9e7
PS
41 ;;
42 restart|force-reload)
43 start
b1b044b0 44 exit $?
3a06e9e7
PS
45 ;;
46 status)
47 /usr/sbin/ipset -L --sorted --numeric
b1b044b0 48 exit $?
3a06e9e7
PS
49 ;;
50 save)
51 show "Saving current rules to %s" $IPSET_CONFIG
52 touch $IPSET_CONFIG
53 chmod 600 $IPSET_CONFIG
b1b044b0
PS
54 /usr/sbin/ipset -S > $IPSET_CONFIG && ok || fail
55 exit $?
3a06e9e7
PS
56 ;;
57 *)
58 msg_usage "$0 {start|stop|restart|force-reload|status|save}"
59 exit 3
60esac
This page took 0.026749 seconds and 4 git commands to generate.