Here my script to start the snapcreator gui during server startup. I'm using RHEL, so I deleted the init configuration for SLES. If you are using SLES, delete the RHEL init configuration. I never checked the SLES configuration, but iit should be run. Maybe you have to change a little bit for other distributions.
Be careul to use another running environment than root. Most Jobs will run but at least the vSphere plugin needs root priviledges because it is using icmp ping to check the availability of the vSphere server.
#!/bin/sh
#
# snapcreator-gui This shell script takes care of starting and stopping
# snapcreator gui server.
#
# ---- DO NOT REMOVE !!! The following comments needed by RHEL ----
#
# chkconfig: 2345 95 5
# description: snapcreator framework gui server
# processname: snapcreator-gui
#
# ---- DO NOT REMOVE !!! The following comments needed by RHEL ----
# ---- DO NOT REMOVE !!! The following comments needed by SUSE ----
### BEGIN INIT INFO
# Provides: snapcreator-gui
# Required-Start: $network
# Should-Start: $all
# Required-Stop: $all
# Default-Start: 3 5
# Default-Stop: 0 1 2 3 5 6
# Description: snapcreator framework gui server
### END INIT INFO
# ---- DO NOT REMOVE !!! The above comments needed by SUSE --------
export SnapCreGUI=/opt/NetApp/snapcreator/scServer/gui
export SnapCreJAR=snapcreator.jar
export SnapCreLOG=/opt/NetApp/snapcreator/scServer/logs/snapcreator-javaserver.log
export SnapCrePORT=8085
#export SnapCreUSER=snapcrea
export SnapCreUSER=root
function usage()
{
echo "Call: $0 start|stop|restart|status"
exit 1
}
function is_running()
{
SnapCrePID=$(ps -ef | grep 'java -jar snapcreator.jar' | grep -v grep | awk ' { printf "%s ",$2 }')
echo "$SnapCrePID" | sed -e 's/ $//g'
}
function status_snapcreator()
{
if [ $(is_running) ]
then echo -e "snapcreator gui server is running with pid $(is_running)."
else echo -e "snapcreator gui server is not running."
fi
}
function start_snapcreator()
{
echo -e "start snapcreater gui server: \c"
if [ $(is_running) ]
then
echo -e "snapcreator gui server is running with pid $(is_running). Nothing to do."
else
if [ -f $SnapCreGUI/$SnapCreJAR ]
then
su - $SnapCreUSER -c "cd $SnapCreGUI; java -jar $SnapCreJAR -gui_port $SnapCrePORT >$SnapCreLOG 2>&1 &"
sleep 10
if [ $(is_running) ]
then
echo -e "running with pid $(is_running)"
else
echo -e "snapcreator gui server is not startable, see Logfile $SnapCreLOG"
exit 1
fi
else
echo -e "$SnapCreGUI/$SnapCreJAR missing"
exit 1
fi
fi
}
function stop_snapcreator()
{
echo -e "stop snapcreater gui server: \c"
if ! [ $(is_running) ]
then
echo -e "snapcreator gui server is not running. Nothing to do."
else
kill $(is_running)
sleep 10
if [ $(is_running) ]
then
echo "Killing java with -9"
kill -9 $(is_running)
else
echo "done"
fi
fi
rm -rf /tmp/Jetty_0_0_0_0_8085_snapcreator*
}
case "$1" in
start) start_snapcreator
;;
stop) stop_snapcreator
;;
restart) stop_snapcreator
sleep 5
start_snapcreator
;;
status) status_snapcreator
;;
*) echo -e "\nmissing or wrong parameter"
usage
;;
esac
exit 0
Regards
Volker