]> git.pld-linux.org Git - packages/libcgroup.git/blame - cgconfig.init
- 0.38.rc1
[packages/libcgroup.git] / cgconfig.init
CommitLineData
382db189
JR
1#!/bin/sh
2#
3# cgconfig Control Groups Configuration Startup
dcbb2e58 4# chkconfig: 2345 01 99
382db189
JR
5# description: This script runs the cgconfigparser utility to parse and setup \
6# the control group filesystem. It uses /etc/cgconfig.conf \
7# and parses the configuration specified in there.
8
9# Source function library
10. /etc/rc.d/init.d/functions
11
12# read the config
382db189
JR
13[ -f /etc/sysconfig/cgconfig ] && . /etc/sysconfig/cgconfig
14
382db189
JR
15start() {
16 # Check if the service is already running?
17 if [ -f /var/lock/subsys/cgconfig ]; then
18 msg_already_running "cgconfig"
19 return
20 fi
382db189 21 if [ ! -s /etc/cgconfig.conf ]; then
04ae980e 22 nls "/etc/cgconfig.conf is not configured"
2ba2a72e
ER
23 RETVAL=6
24 return
382db189 25 fi
ffc5c83f
JR
26 msg_starting "cgconfig"; busy
27 local out
2ba2a72e 28 out=$(/sbin/cgconfigparser -l /etc/cgconfig.conf 2>&1)
ffc5c83f
JR
29 RETVAL=$?
30 if [ $RETVAL -ne 0 ]; then
31 fail
32 [ "$out" ] && echo >&2 "$out"
33 exit $RETVAL
382db189
JR
34 fi
35
ffc5c83f
JR
36 RETVAL=$?
37 [ $RETVAL -eq 0 ] && touch /var/lock/subsys/cgconfig
382db189
JR
38 ok
39}
40
41stop() {
2ba2a72e 42 if [ ! -f /var/lock/subsys/cgconfig ]; then
382db189 43 msg_not_running "cgconfig"
2ba2a72e 44 return
382db189 45 fi
2ba2a72e
ER
46
47 msg_stopping "cgconfig"
48 cgclear
92816bbf 49 cgclear
2ba2a72e
ER
50 rm -f /var/lock/subsys/cgconfig
51 ok
382db189
JR
52}
53
2ba2a72e
ER
54condrestart() {
55 if [ ! -f /var/lock/subsys/cgconfig ]; then
56 msg_not_running "cgconfig"
57 RETVAL=$1
58 return
59 fi
382db189 60
2ba2a72e
ER
61 stop
62 start
63}
64
65RETVAL=0
382db189
JR
66case "$1" in
67 start)
68 start
69 ;;
70 stop)
2ba2a72e 71 stop
382db189 72 ;;
2ba2a72e 73 restart)
382db189
JR
74 stop
75 start
76 ;;
2ba2a72e
ER
77 try-restart)
78 condrestart 0
79 ;;
80 force-reload)
81 condrestart 7
382db189
JR
82 ;;
83 status)
84 if [ -f /var/lock/subsys/cgconfig ] ; then
85 echo "Running"
86 exit 0
87 else
88 echo "Stopped"
89 exit 3
90 fi
91 ;;
92 *)
2ba2a72e 93 msg_usage "$0 {start|stop|restart|try-restart|force-reload|status}"
382db189
JR
94 exit 3
95 ;;
96esac
97
98exit $RETVAL
This page took 0.043286 seconds and 4 git commands to generate.