]> git.pld-linux.org Git - packages/ipset.git/blame - ipset.init
- initial revision.
[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"
21 /usr/sbin/ipset -R $IPSET_CONFIG && ok || fail
22 touch /var/lock/subsys/ipset
23 fi
24}
25
26stop() {
27 show "Resetting ipset rules"
28 /usr/sbin/ipset -X && ok || fail
29 rm -f /var/lock/subsys/ipset
30}
31
32case "$1" in
33 start)
34 start
35 ;;
36 stop)
37 stop
38 ;;
39 restart|force-reload)
40 start
41 ;;
42 status)
43 /usr/sbin/ipset -L --sorted --numeric
44 ;;
45 save)
46 show "Saving current rules to %s" $IPSET_CONFIG
47 touch $IPSET_CONFIG
48 chmod 600 $IPSET_CONFIG
49 /usr/sbin/ipset -S > $IPSET_CONFIG 2>/dev/null && ok || fail
50 ;;
51 *)
52 msg_usage "$0 {start|stop|restart|force-reload|status|save}"
53 exit 3
54esac
55
56exit 0
This page took 0.198604 seconds and 4 git commands to generate.