#!/bin/sh # db2 Startup script for DB2 Universal Database # # chkconfig: - 85 15 # description: DB2 Universal Database # processname: db2sysc # Source function library . /etc/rc.d/init.d/functions # Find the name of the script BASENAME=`basename $0` # For SELinux we need to use 'runuser' not 'su' if [ -x /sbin/runuser ] then SU=runuser else SU=su fi script_result=0 start() { DB2_START=$"Starting ${BASENAME} service: " echo -n "$DB2_START" $SU -l db2inst -c "db2start > /dev/null" ret=$? if [ $ret -eq 0 ] then success "$DB2_START" else failure "$DB2_START" script_result=1 fi echo } stop() { echo -n $"Stopping ${BASENAME} service: " $SU -l db2inst -c "db2stop > /dev/null" ret=$? if [ $ret -eq 0 ] then echo_success else echo_failure script_result=1 fi echo } case "$1" in start) start ;; stop) stop ;; status) status db2sysc script_result=$? ;; restart) stop start ;; *) echo $"Usage: $0 {start|stop|status|restart}" script_result=1 esac exit $script_result