Debian Codegraph @

numad.init

raw
1 #!/bin/bash
2 # chkconfig: - 99 1
3 # description: Control operation of numad which will monitor and
4 # rebalance assignment of NUMA resources
5
6 ### BEGIN INIT INFO
7 # Provides: numad
8 # Required-Start: cgconfig
9 # Required-Stop:
10 # Should-Start:
11 # Should-Stop:
12 # Default-Start:
13 # Default-Stop:
14 # Short-Description: numad control
15 # Description:
16 ### END INIT INFO
17
18 if [ $(id -u) -ne 0 ]; then
19 echo "This script can be run by root only. Exiting."
20 exit 4
21 fi
22
23 # Source function library.
24 . /etc/rc.d/init.d/functions
25
26 exec="/usr/bin/numad"
27 prog="numad"
28 config="/etc/numad.conf"
29
30 [ -e /etc/sysconfig/$prog ] && . /etc/sysconfig/$prog
31
32 lockfile=/var/lock/subsys/$prog
33 base=${0##*/}
34
35 start() {
36 [ -x $exec ] || exit 5
37 [ -f $config ] || exit 6
38 echo -n $"Starting $prog: "
39 . $config
40 daemon $exec -i $INTERVAL
41 retval=$?
42 echo
43 [ $retval -eq 0 ] && touch $lockfile
44 return $retval
45 }
46
47 stop() {
48 echo -n $"Stopping $prog: "
49 killproc $prog
50 retval=$?
51 echo
52 [ $retval -eq 0 ] && rm -f $lockfile
53 return $retval
54 }
55
56 restart() {
57 stop
58 start
59 }
60
61 reload() {
62 restart
63 }
64
65 force_reload() {
66 restart
67 }
68
69 rh_status() {
70 # run checks to determine if the service is running or use generic status
71 status $prog
72 }
73
74 rh_status_q() {
75 rh_status >/dev/null 2>&1
76 }
77
78
79 case "$1" in
80 start)
81 rh_status_q && exit 0
82 $1
83 ;;
84 stop)
85 rh_status_q || exit 0
86 $1
87 ;;
88 restart)
89 $1
90 ;;
91 reload)
92 rh_status_q || exit 7
93 $1
94 ;;
95 force-reload)
96 force_reload
97 ;;
98 status)
99 rh_status
100 ;;
101 condrestart|try-restart)
102 rh_status_q || exit 0
103 restart
104 ;;
105 *)
106 echo $"Usage: $0 {start|stop|status|restart|condrestart|try-restart|reload|force-reload}"
107 exit 2
108 esac
109 exit $?