#! /bin/sh # Copyright (c) 2002-2004 SuSE Linux AG, Nuernberg, Germany. # All rights reserved. # # Author: Lars Mueller # Author: Bernd Stalder <@> # /etc/init.d/netxmsd # and its symbolic link # /usr/sbin/rcnetxmsd # ### BEGIN INIT INFO # Provides: netxmsd # Description: netXMS Server netxmsd ### END INIT INFO STARTPATH=/opt/netxms-0.2.20 NETXMS_BIN="${STARTPATH}/bin/netxmsd" NETXMS_CONF="/etc/netxmsd.conf" PID_FILE="/var/run/netxmsd.pid" # for debug activate -D and 0 - 9 as Option #NETXMS_OPTIONS="" NETXMS_OPTIONS="-d -D 2" . /etc/rc.status rc_reset # Check for missing binary if [ ! -x ${NETXMS_BIN} ]; then echo -n >&2 "netXMS Server netxms daemon, ${NETXMS_BIN} is not installed. " rc_status -s exit 5 fi case "$1" in start) echo -n "Starting netXMS Server netxms daemon " if [ ! -f ${NETXMS_CONF} ]; then echo -n >&2 "netXMS Server configuration file, ${NETXMS_CONF} does not exist. " rc_status -s exit 6 fi checkproc -p ${PID_FILE} ${NETXMS_BIN} case $? in 0) echo -n "- Warning: daemon already running. " ;; 1) echo -n "- Warning: ${PID_FILE} exists. " ;; esac $STARTPATH/bin/nxdbmgr -f check 1>/dev/null 2>/dev/null startproc ${NETXMS_BIN} ${NETXMS_OPTIONS} --config ${NETXMS_CONF} --pid-file ${PID_FILE} rc_status -v ;; stop) echo -n "Shutting down netXMS Server daemon " checkproc -p ${PID_FILE} ${NETXMS_BIN} || \ echo -n " Warning: daemon not running. " killproc -p ${PID_FILE} -t 10 ${NETXMS_BIN} rc_status -v ;; restart) $0 stop $0 start rc_status ;; status) echo -n "Checking for netXMS Server daemon " checkproc -p ${PID_FILE} ${NETXMS_BIN} rc_status -v ;; *) echo "Usage: $0 {start|stop|status|restart}" exit 1 ;; esac rc_exit