3 # cgred CGroups Rules Engine Daemon
4 # chkconfig: 2345 02 98
5 # description: This is a daemon for automatically classifying processes \
6 # into cgroups based on UID/GID.
8 # processname: cgrulesengd
9 # pidfile: /var/run/cgrulesengd.pid
12 # Source function library
13 . /etc/rc.d/init.d/functions
15 # Read in configuration options.
16 [ -f /etc/sysconfig/cgred ] && . /etc/sysconfig/cgred
19 if [ -f /var/lock/subsys/cgred ]; then
20 msg_already_running "CGroup Rules Engine Daemon"
24 if [ ! -s /etc/cgrules.conf ]; then
25 nls "CGroup Rules Engine Daemon not configured"
29 if ! grep -qs "^cgroup" /proc/mounts; then
30 nls "Cannot find cgroups, is cgconfig service running?"
35 msg_starting "CGroup Rules Engine Daemon"
37 daemon --pidfile /var/run/cgrulesengd.pid /sbin/cgrulesengd $OPTIONS
39 if [ $RETVAL -ne 0 ]; then
42 touch /var/lock/subsys/cgred
43 pidof cgrulesengd > /var/run/cgrulesengd.pid
47 if [ ! -f /var/lock/subsys/cgred ]; then
48 msg_not_running "CGroup Rules Engine Daemon"
52 msg_stopping "CGroup Rules Engine Daemon"
53 killproc --pidfile /var/run/cgrulesengd.pid cgrulesengd -TERM
55 rm -f /var/lock/subsys/cgred /var/run/cgrulesengd.pid
59 if [ ! -f /var/lock/subsys/cgred ] ; then
60 msg_not_running "CGroup Rules Engine Daemon"
64 show "Reloading rules configuration..."
66 kill -s 12 $(cat ${pidfile})
68 if [ $RETVAL -eq 0 ]; then
76 if [ ! -f /var/lock/subsys/cgred ]; then
77 msg_not_running "CGroup Rules Engine Daemon"
87 # See how we are called
109 status --pidfile /var/run/cgrulesengd.pid cgrulesengd
113 msg_usage "$0 {start|stop|restart|try-restart|reload|force-reload|status}"