Solaris packaing fixed
[public/netxms.git] / contrib / startup / redhat / nxhttpd.in
1 #!/bin/sh
2 # $Id$
3 #
4 # nxhttpd This script starts and stops the nxhttpd daemon
5 #
6 # chkconfig: 2345 90 10
7 #
8 # description: nxhttpd is a NetXMS web server process
9
10 NETXMS_BINDIR="~BINDIR~"
11 NETXMS_LIBDIR="~LIBDIR~"
12
13 # Source function library.
14 if [ -f /etc/init.d/functions ]; then
15 . /etc/init.d/functions
16 elif [ -f /etc/rc.d/init.d/functions ]; then
17 . /etc/rc.d/init.d/functions
18 else
19 echo "Could not find functions file, your system may be broken."
20 exit 1
21 fi
22
23 # Source networking configuration.
24 . /etc/sysconfig/network
25
26 # Check that networking is up.
27 [ ${NETWORKING} = "no" ] && exit 0
28
29 # Default config
30 NXHTTPD_OPTIONS=""
31 NXHTTPD_CONFIG="/etc/nxhttpd.conf"
32 NXHTTPD_PID_FILE="/var/run/nxhttpd.pid"
33
34 # Source nxagentd configuration.
35 if [ -f /etc/sysconfig/nxhttpd ] ; then
36 . /etc/sysconfig/nxhttpd
37 fi
38
39 [ -f $NETXMS_BINDIR/nxhttpd ] || exit 0
40 LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$NETXMS_LIBDIR
41
42 # See how we were called.
43 case "$1" in
44 start)
45 # Start daemon.
46 echo -n "Starting NetXMS Web Server: "
47 daemon $NETXMS_BINDIR/nxhttpd -d $NXHTTPD_OPTIONS -c $NXHTTPD_CONFIG -p $NXHTTPD_PID_FILE
48 RETVAL=$?
49 echo
50 [ $RETVAL = 0 ] && touch /var/lock/subsys/nxhttpd
51 ;;
52 stop)
53 # Stop daemons.
54 echo -n "Shutting down NetXMS Web Server: "
55 kill `cat $NXHTTPD_PID_FILE 2>/dev/null` 2> /dev/null
56 RETVAL=$?
57 if [ $RETVAL = 0 ] ; then
58 success
59 else
60 failure
61 fi
62 echo
63 [ $RETVAL = 0 ] && rm -f /var/lock/subsys/nxhttpd
64 ;;
65 restart)
66 $0 stop
67 $0 start
68 ;;
69 condrestart)
70 [ -e /var/lock/subsys/nxagentd ] && $0 restart
71 ;;
72 status)
73 status nxhttpd
74 ;;
75 *)
76 echo "Usage: $0 {start|stop|restart|status|condrestart}"
77 exit 1
78 esac
79
80 exit 0