Although not specifically for SLES 11, I've used a variation of this on
SLES 9, 10 and 11. It should live in /etc/rc.d and works with chkconfig.
#! /bin/sh
### BEGIN INIT INFO
# Provides: xymon
# Required-Start: network
# Required-Stop: network
# Default-Start: 3 5
# Default-Stop: 3
# Description: Start the Xymon network monitor
### END INIT INFO
case "$1" in
start)
echo "Starting Xymon"
su - xymon -c "cd /home/xymon/server; ./hobbit.sh start"
;;
stop)
echo "Stopping Xymon"
su - xymon -c "cd /home/xymon/server; ./hobbit.sh stop"
;;
restart)
$0 stop
$0 start
rc_status
;;
*)
echo "Usage: $0 {start|stop|restart}"
exit 1
;;
esac
Ah, slightly different to CentOS/Redhat - with those you don't need the "Starting Xymon" / "Stopping Xymon" as these are displayed anyway.
What's the reason for changing directory? What's rc_status in this context? Is there a reason for not using "./hobbit.sh restart" instead of "stop / start"?
Malcolm
--
Technical copy-editor & proofreader
KDE Proofreading Team
KDE British English Translation Team
http://l10n.kde.org/team-infos.php?teamcode=en_GB
Facebook: http://www.facebook.com/FriendlyAtheist
Jetzt kostenlos herunterladen: Internet Explorer 8 und Mozilla Firefox 3.5 -
sicherer, schneller und einfacher! http://portal.gmx.net/de/go/chbrowser