| | |
| | | |
| | | |
| | | # Sets the script vars |
| | | INSTALL_ROOT="/opt/opendj/" |
| | | INSTALL_ROOT="/opt/opendj" |
| | | export INSTALL_ROOT |
| | | DAEMON=opendj |
| | | |
| | |
| | | # Recreates the symlink if needed (/var/run is deleted after reboot (eg. debian)). |
| | | test -h "$PIDFILE" || ln -s $ORIGINPIDFILE $PIDFILE |
| | | |
| | | instance_configured() { |
| | | if [ -f $INSTALL_ROOT/config/buildinfo ] && [ "$(ls -A $INSTALL_ROOT/config/archived-configs)" ] ; then |
| | | return 1 |
| | | fi |
| | | |
| | | return 0 |
| | | } |
| | | |
| | | # Starts the server and creates pid file. |
| | | start() { |
| | | instance_configured |
| | | if [ $? = 0 ] ; then |
| | | echo "Instance is not configured. Please run $INSTALL_ROOT/setup" |
| | | return 1 |
| | | fi |
| | | echo -n "Starting $DAEMON: " |
| | | # Server is running |
| | | if [ -e $PIDFILE ] ; then |
| | |
| | | |
| | | # Stops the server and removes pid file. |
| | | stop() { |
| | | instance_configured |
| | | if [ $? = 0 ] ; then |
| | | echo "Instance is not configured. Please run $INSTALL_ROOT/setup" |
| | | return 1 |
| | | fi |
| | | |
| | | echo -n "Stopping $DAEMON: " |
| | | if [ -e $PIDFILE ] |
| | | then |
| | |
| | | |
| | | # Displays the service status |
| | | status() { |
| | | instance_configured |
| | | if [ $? = 0 ] ; then |
| | | echo "Instance is not configured. Please run $INSTALL_ROOT/setup" |
| | | return 1 |
| | | fi |
| | | |
| | | echo -n $"$DAEMON status: " |
| | | if [ -e $PIDFILE ] ; then |
| | | echo "> Running." |
| | |
| | | stop |
| | | ;; |
| | | restart) |
| | | stop |
| | | sleep 5 |
| | | start |
| | | instance_configured |
| | | if [ $? = 0 ] ; then |
| | | echo "Instance is not configured. Please run $INSTALL_ROOT/setup" |
| | | exit 1 |
| | | else |
| | | stop |
| | | sleep 5 |
| | | start |
| | | fi |
| | | ;; |
| | | force-reload) |
| | | # Not implemented. |