| | |
| | | # |
| | | # CDDL HEADER END |
| | | # |
| | | # Copyright 2013 ForgeRock AS |
| | | # Copyright 2013-2015 ForgeRock AS |
| | | # |
| | | |
| | | |
| | |
| | | ### END INIT INFO |
| | | |
| | | # Set up source function library depending on the distribution |
| | | if [ -f /etc/redhat-release ] |
| | | then |
| | | if [ -f /etc/redhat-release ] ; then |
| | | # Redhat |
| | | . /etc/init.d/functions |
| | | elif [ -f /etc/SuSE-release ] |
| | | then |
| | | elif [ -f /etc/SuSE-release ] ; then |
| | | # SuSE |
| | | . /etc/rc.status |
| | | elif [ -f /etc/lsb-release ] |
| | | then |
| | | elif [ -f /etc/lsb-release ] ; then |
| | | # Debian |
| | | . /lib/lsb/init-functions |
| | | else |
| | | elif [ -f /etc/init.d/functions.sh ] ; then |
| | | # Other dist. |
| | | if [ -f /etc/init.d/functions.sh ] |
| | | then |
| | | . /etc/init.d/functions.sh |
| | | fi |
| | | fi |
| | | |
| | | |
| | | # Sets the script vars |
| | | INSTALL_ROOT="/opt/opendj/" |
| | | export INSTALL_ROOT |
| | | DAEMON=opendj |
| | | |
| | | # Original PID file |
| | | ORIGINPIDFILE=/opt/opendj/logs/server.pid |
| | | |
| | | # Pid file is a symlink to /opt/opendj/log/server.pid |
| | | PIDFILE=/var/run/opendj.pid |
| | | RETVAL=0 |
| | |
| | | # If the daemon is not there, then exit / LSB return code. |
| | | test -x "$INSTALL_ROOT/bin/start-ds" || exit 5 |
| | | |
| | | # /var/run is deleted after reboot (eg. debian) |
| | | # recreates the symlink if needed. |
| | | # Recreates the symlink if needed (/var/run is deleted after reboot (eg. debian)). |
| | | test -h "$PIDFILE" || ln -s $ORIGINPIDFILE $PIDFILE |
| | | |
| | | #Starts the server and creates pid file. |
| | | start() { |
| | | echo -n $"Starting $DAEMON: " |
| | | echo -n "Starting $DAEMON: " |
| | | # Server is running |
| | | if [ -e $PIDFILE ] |
| | | then |
| | | if [ -e $PIDFILE ] ; then |
| | | echo "> Already running." |
| | | return 0 |
| | | else |
| | | "$INSTALL_ROOT"/bin/start-ds --quiet |
| | | RETVAL=$? |
| | | if [ $RETVAL = 0 ] |
| | | then |
| | | if [ $RETVAL = 0 ] ; then |
| | | echo "> SUCCESS." |
| | | else |
| | | echo "> FAILURE." |
| | |
| | | |
| | | #Stops the server and removes pid file. |
| | | stop() { |
| | | echo -n $"Stopping $DAEMON: " |
| | | # Server is running |
| | | echo -n "Stopping $DAEMON: " |
| | | if [ -e $PIDFILE ] |
| | | then |
| | | # Server is running |
| | | "$INSTALL_ROOT"/bin/stop-ds --quiet |
| | | RETVAL=$? |
| | | if [ $RETVAL = 0 ] |
| | | then |
| | | if [ $RETVAL = 0 ] ; then |
| | | echo "> SUCCESS." |
| | | else |
| | | echo "> FAILURE." |
| | |
| | | # Displays the service status |
| | | status() { |
| | | echo -n $"$DAEMON status: " |
| | | if [ -e $PIDFILE ] |
| | | then |
| | | if [ -e $PIDFILE ] ; then |
| | | echo "> Running." |
| | | return 0 |
| | | else |
| | |
| | | ;; |
| | | force-reload) |
| | | # Not implemented. |
| | | echo "Not implemented." |
| | | ;; |
| | | status) |
| | | status |
| | | ;; |
| | | *) |
| | | echo $"Usage: /etc/init.d/$DAEMON {start|restart|stop|force-reload|status}" |
| | | echo "Usage: /etc/init.d/$DAEMON {start|restart|stop|force-reload|status}" |
| | | exit 1 |
| | | ;; |
| | | esac |