#!/bin/bash # # db12 Run DB12 fast benchmark and create /etc/db12 files # # chkconfig: 345 09 91 # 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