updated on Sun Jan 22 04:03:10 UTC 2012
[aur-mirror.git] / libcgroup / cgred
blob082b38292884bab0d1c98145dbaa5b95c3efaea9
1 #!/bin/bash
3 . /etc/rc.conf
4 . /etc/rc.d/functions
6 . /etc/conf.d/cgred
7 OPTIONS="$NODAEMON $LOG"
8 if [ -n "$LOG_FILE" ]; then
9 OPTIONS="$OPTIONS --logfile=$LOG_FILE"
11 if [ -n "$SOCKET_USER" ]; then
12 OPTIONS="$OPTIONS -u $SOCKET_USER"
14 if [ -n "$SOCKET_GROUP" ]; then
15 OPTIONS="$OPTIONS -g $SOCKET_GROUP"
18 PID=`pidof -o %PPID /sbin/cgrulesengd`
19 case "$1" in
20 start)
21 stat_busy "Starting CGroups rules engine daemon"
22 if [ -z "$PID" ]; then
23 # Load Connector support
24 modprobe cn
25 sleep 0.1
26 /sbin/cgrulesengd $OPTIONS
28 if [ ! -z "$PID" -o $? -gt 0 ]; then
29 stat_fail
30 else
31 add_daemon cgred
32 stat_done
35 stop)
36 stat_busy "Stopping CGroups rules engine daemon"
37 [ ! -z "$PID" ] && kill $PID &> /dev/null
38 if [ $? -gt 0 ]; then
39 stat_fail
40 else
41 rm_daemon cgred
42 stat_done
45 restart)
46 $0 stop
47 sleep 1
48 $0 start
51 echo "usage: $0 {start|stop|restart}"
52 esac
54 # vim:set ft=sh: