File: cpudyn.redhat

package info (click to toggle)
cpudyn 1.0-2.1
  • links: PTS
  • area: main
  • in suites: lenny, squeeze
  • size: 184 kB
  • ctags: 118
  • sloc: ansic: 1,114; sh: 203; makefile: 122
file content (71 lines) | stat: -rw-r--r-- 1,085 bytes parent folder | download | duplicates (2)
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
#!/bin/bash
#
# chkconfig: 2345 90 10
# description: CPUDYN CPU Dynamic frecuency daemon. Controls the CPU's speed.
# 
# processname: cpudynd
# pidfile: /var/run/cpudyn.pid
# config: /etc/sysconfig/cpudyn
# author: Tomeu Cap

# source function library
. /etc/init.d/functions
[ -e /etc/sysconfig/cpudyn ] && . /etc/sysconfig/cpudyn

CPUDYNCFG=/etc/sysconfig/cpudyn

RETVAL=0

start() {
	echo -n $"Starting CPUDyn: "
	if [ -f "$CPUDYNCFG" ]; then
		. "$CPUDYNCFG"
	else
		echo $"(CPYDyn is not configured)"
		exit 0
	fi

	if [ -z "$OPTS" ]; then
	    OPTS="-d -i 1 -p 0.5 0.90"
#	    OPTS="-d -i 1 -p 0.5 0.90 -t 120"
	fi

        daemon cpudynd $OPTS

        RETVAL=$?
	echo
	[ $RETVAL -eq 0 ] && touch /var/lock/subsys/cpudyn
}

stop() {
	echo -n $"Shutting down CPUDyn: "
	killproc cpudynd
	RETVAL=$?

	echo
	[ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/cpudyn
}

case "$1" in
  start)
	start
	;;
  stop)
	stop
	;;
  restart|reload)
	stop
	start
	RETVAL=$?
	;;
  status)
	status cpudynd
	RETVAL=$?
	;;
  *)
	echo $"Usage: $0 {start|stop|restart|status}"
	exit 1
esac

exit $RETVAL