Hi,
below you will find my working init.d Script for RedHat. The scripts is for headless mode configurations, where the RRC server requires an X virtual framebuffer started in the background. My RRC instance is running on port 9444.
Line Xvfb :1 -dpi 96 -screen 0 800x600x24 & will start the X virtual framebuffer before starting the Tomcat based RRC server.
Best Regards
Ren
#!/bin/sh
# rrc
#
# chkconfig: 35 95 25
### BEGIN INIT INFO
# Provides: rrc
# Required-Start: $local_fs $network $syslog $db2
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: rrc
# Description: rrc
### END INIT INFO
# Source function library
. /etc/rc.d/init.d/functions
script_result=0
start() {
rrc_START=$"Starting rrc service: "
echo -n "$rrc_START"
Xvfb :1 -dpi 96 -screen 0 800x600x24 &
export DISPLAY=localhost:1.0
/opt/IBM/RRCS20/server/server.startup
ret=$?
if [ $ret -eq 0 ]
then
success "$rrc_START"
else
failure "$rrc_START"
script_result=1
fi
echo
}
stop() {
echo -n $"Stopping rrc service: "
/opt/IBM/RRCS20/server/server.shutdown
killall Xvfb
ret=$?
if [ $ret -eq 0 ]
then
echo_success
else
echo_failure
script_result=1
fi
echo
}
checkrrcstate()
{
# check if rrc is running and listening on HTTPS
javagrep=(`netstat -tlp | grep 9444.*java`)
if [ -z $javagrep ];then
echo $"${base} is stopped"
return 3
else
# get the pid
pid=`netstat -tlp | grep 9444.*java | sed -e 's/ //g' | sed -e 's/^.*LISTEN\(.*\)\/java.*/\1/g'`
echo $"rrc (pid $pid) is running..."
return 0
fi
}
case "$1" in
start)
start
;;
stop)
stop
;;
status)
checkrrcstate
script_result=$?
;;
restart)
stop
start
;;
*)
echo $"Usage: $0 {start|stop|status|restart}"
script_result=1
esac
exit $script_result