forked from inverse-inc/packetfence
-
Notifications
You must be signed in to change notification settings - Fork 0
/
packetfence.init
executable file
·84 lines (77 loc) · 1.57 KB
/
packetfence.init
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
#!/bin/bash
#
# Init script for PacketFence network registration / worm mitigation system
#
# chkconfig: 345 90 10
# description: PacketFence network registration / worm mitigation system
#
# processname:
# config: /usr/local/pf/conf/pf.conf
source /etc/rc.d/init.d/functions
[ -x /usr/local/pf/bin/pfcmd ] || exit 1
start() {
#Check if MySQL is started
if [ ! -f /var/run/mysqld/mysqld.pid ]; then
[ -d /var/lib/mysql/pf ] && /etc/init.d/mysqld start
fi
echo -n $"Starting PacketFence..."
IPSET=`command -v ipset`
if [ $IPSET ]; then
modprobe ip_set
#flush any previous ipset rules
/usr/sbin/ipset destroy
fi
/sbin/vconfig set_name_type DEV_PLUS_VID_NO_PAD
/usr/local/pf/bin/pfcmd service pf start
RETVAL=$?
echo
return $RETVAL
}
stop() {
echo -n $"Shutting down PacketFence..."
/usr/local/pf/bin/pfcmd service pf stop
RETVAL=$?
echo
return $RETVAL
}
restart() {
#Check if MySQL is started
if [ ! -f /var/run/mysqld/mysqld.pid ]; then
[ -d /var/lib/mysql/pf ] && /etc/init.d/mysqld start
fi
echo -n $"Restarting PacketFence..."
/usr/local/pf/bin/pfcmd service pf restart
RETVAL=$?
echo
return $RETVAL
}
case "$1" in
start)
start
;;
stop)
stop
;;
restart)
restart
;;
status)
/usr/local/pf/bin/pfcmd service pf status
if [ ! -f /usr/local/pf/var/run/pfmon.pid ]; then
RETVAL=3
fi
;;
condrestart)
if [ -f /usr/local/pf/var/run/pfmon.pid ]; then
restart
else
if [ -f /usr/local/pf/var/run/pfsetvlan.pid ]; then
restart
fi
fi
;;
*)
echo $"Usage: $0 {start|stop|restart|condrestart|status}"
RETVAL=1
esac
exit $RETVAL