db12.init 1.2 KB
Newer Older
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
#!/bin/bash
#
# db12		Run DB12 fast benchmark and create /etc/db12 files
#
# chkconfig: 345 10 90
# description: Run DB12 fast benchmark and create /etc/db12 files

# Source function library.
. /etc/init.d/functions

# If total_cpu is already created (in Kickstart?), we use that:
#
if [ -f /etc/db12/total_cpu ] ; then
  $total_cpu=`cat /etc/db12/total_cpu`
fi

if [ "$total_cpu" == "" ] ; then
  # If total_cpu not given in /etc/sysconfig/db12 then count OS processors
  total_cpu=`grep '^processor[[:space:]]*:' /proc/cpuinfo | wc --lines`
  mkdir -p /etc/db12
  echo '$total_cpu' > /etc/db12/total_cpu
fi

start() {
	[ "$EUID" != "0" ] && exit 1

        echo -n $"Run DB12 fast benchmark: "

        db12_sum=`/usr/sbin/diracBenchmark.py $total_cpu | cut -f2 -d' '`

        if [ "$db12_sum" != "" ] ; then
          echo "$db12_sum" > /etc/db12/db12
        fi

        echo_success
        echo
	return 0
}

stop() {
	[ "$EUID" != "0" ] && exit 3

        echo -n $"Dummy DB12 stop action: "
        echo_success
        echo
	return 0
}

case "$1" in
  start)
	start
	;;
  stop)
	stop
	;;
  restart|force-reload|reload)
        stop
	start
	;;
  *)
	echo $"Usage: $0 {start|stop|restart|force-reload|reload}"
	exit 4
esac