You can translate the document:

Goal

The different services of the Denodo Platform can be configured to be automatically started as part of the startup process of an operating system. This document lists examples of scripts that can be used on Linux systems to automate the startup process of the Denodo services

Content

  1. In case of Linux systems if you want to run Denodo as Linux Services, it will be necessary to create shell scripts with the startup and shutdown steps.
  2. Once the scripts are ready, move the scripts files to /etc/init.d folder.
  3. Then, invoke them by executing the following commands from the terminal.

If you use Systemd:

First, modify the file paths of the .sh scripts for your installation, and replace the user with the user that is to start the servers.

Then, place the .sh scripts in /usr/local/bin, and the .service files in /etc/systemd/system.

Finally, load the scripts as Services, and prepare them for executing next boot by executing,

~$ systemctl daemon-reload

~$ systemctl enable <service_name>

Invoke the same as,

~$ systemctl start/stop/restart <service_name>

The .service files need to have execution privileges. If they do not have this privilege, an “unrecognized service” error will be thrown when running the service. Note as well the before and after sections of the .service files, which establish the order that the services will be started. It’s important to have the License Manager start first, so the other services are able to obtain their licenses in order to start. Please also note that the provided scripts for the web tools don’t run a check for a previously running instance, and those that do are targeted at the -DDENODO_APP jvm option in the startup command generated by the original startup scripts.

If you use SysVinit:

Execute the services automatically using,

~$ chkconfig <service_name> --add

~$ chkconfig <service_name> on

Invoke the service as,

~$ service <service_name> start/stop/restart

Scripts and unit files for systemd

denodo.properties

DENODO_HOME=/opt/denodo-solution-manager

DENODO_USER=denodo

JAVA_HOME=${DENODO_HOME}/jre

PATH=${JAVA_HOME}/bin:${DENODO_HOME}/bin:${DENODO_HOME}/bin/systemd:${PATH}

denodo-init

#!/usr/bin/env bash

#

# Custom denodo4gcp properties

. /opt/denodo-solution-manager/bin/systemd/denodo.properties

PIDFILE=${PIDFILE:-${DENODO_HOME}/logs/solutionmanager.pid}

DENODO_PID_CHECK_PATTERN=${DENODO_PID_CHECK_PATTERN:-DENODO_APP=Denodo Platform Solution Manager}

# Return Values

E_SUCCESS=0

E_BAD_PID=3

E_BAD_PARAM=4

E_UNMANAGED=5

case "$1" in

  pre)

    if [ -f $PIDFILE ]; then

      pid=$(< "$PIDFILE")

      if  kill -0 $pid && [[ -r /proc/$pid/cmdline ]] && xargs -0 printf '%s\n' < /proc/$pid/cmdline | /bin/grep -q "$DENODO_PID_CHECK_PATTERN"; then

        echo  "PID file $PIDFILE exists, Denodo service is already running: $pid" >&2

       else

        rm ${PIDFILE}

      fi

    fi

    pid=$(/bin/ps -fwwu $DENODO_USER | /bin/grep "$DENODO_PID_CHECK_PATTERN" | /bin/grep "$DENODO_HOME" | /bin/grep -v grep | /bin/awk '{print $2}')

    if [[ -n "$pid" ]] && [[ -r /proc/$pid/cmdline ]] && xargs -0 printf '%s\n' < /proc/$pid/cmdline | /bin/grep -q "$DENODO_PID_CHECK_PATTERN"; then

      echo  "Denodo service is already running: $pid" >&2

      RETURN_CODE=$E_UNMANAGED

     else

      RETURN_CODE=$E_SUCCESS

    fi

  ;;

  *)

    echo "Usage: $0 [pre]"

    RETURN_CODE=$E_BAD_PARAM

  ;;

esac

exit $RETURN_CODE

licensemanagerserver

#!/usr/bin/env bash

#

# Start/Stop the Denodo License Manager Server Daemon.

#

# Time to wait to...

T_WAIT_TO_STARTUP=20 # After startup

T_WAIT_TO_SHUTDOWN=20 # After shutdown

T_WAIT_TO_KILL=10 # After kill

. /opt/denodo-solution-manager/bin/systemd/denodo.properties

# Denodo service name

DENODO_SERVICE="Denodo License Manager"

# PIDFILE to block concurrent attempts to start the service

PIDFILE=${PIDFILE:-${DENODO_HOME}/logs/licensemanager.pid}

# Pattern to check the process of the service

DENODO_PID_CHECK_PATTERN=${DENODO_PID_CHECK_PATTERN:-DENODO_APP=Denodo Platform License Manager}

# Useful paths

DENODO_SRV_START_SCRIPT="$DENODO_HOME/bin/licensemanager_startup.sh"

DENODO_SRV_STOP_SCRIPT="$DENODO_HOME/bin/licensemanager_shutdown.sh"

# Return Values

E_SUCCESS=0

E_BAD_PID=3

E_BAD_PARAM=4

# Function to get the pid of this service

get_pid() {

  local P=$(/bin/ps -fwwu $DENODO_USER | /bin/grep "$DENODO_PID_CHECK_PATTERN" | /bin/grep "$DENODO_HOME" | /bin/grep -v grep | /bin/awk '{print $2}')

  echo "$P"

}

start(){

  if [ -f $PIDFILE ]; then

    echo -n "$PIDFILE exists, process is already running or crashed\n"

   else

    # Block any other process attempt to launch the service

    touch $PIDFILE

    # Startup script

    $DENODO_SRV_START_SCRIPT

    # Wait to capture the PID.

    sleep $T_WAIT_TO_STARTUP

    # Get pid to write it to $PIDFILE

    local PID=$(get_pid)

    if [ -n $PID ] && (( $PID > 0 )) 2> /dev/null; then

      echo $PID >$PIDFILE

      RETURN_CODE=$E_SUCCESS

     else

      /bin/rm $PIDFILE

      RETURN_CODE=$E_BAD_PID

    fi

  fi

}

stop(){

  if [ ! -f $PIDFILE ]; then

    echo "$DENODO_SERVICE is not running."

   else

    # Shutdown script

    $DENODO_SRV_STOP_SCRIPT

    # Wait to capture the pid

    sleep $T_WAIT_TO_SHUTDOWN

          local PID=$(get_pid)

    if [ -n "$PID" ]; then # It still hasn't stopped

      echo "Termination $PID"        

      # Kill

      kill $PID

      sleep $T_WAIT_TO_KILL

      PID=$(get_pid)

      if [ -n "$PID" ]; then # It still hasn't stopped

        # Kill -9

        kill -9 $PID

                    echo "Abrupt termination"

      fi

    fi

    # Remove blocking file $PIDFILE so that it can be started again

    /bin/rm $PIDFILE

    RETURN_CODE=$E_SUCCESS

  fi

}

case "$1" in

    start)

        start

        ;;

    stop)

        stop

        ;;

    *)

        echo $"Usage: $0 {start|stop}"

        RETURN_CODE=$E_BAD_PARAM

esac

exit $RETURN_CODE

licensemanagerserver.service

[Unit]

Description=Denodo License Manager Service

Wants=network-online.target

After=network-online.target

[Service]

Type=forking

PIDFile=/opt/denodo/denodo-solution-manager/logs/licensemanager.pid

ExecStartPre=+/opt/denodo-solution-manager/lib/sh/denodo-init pre

ExecStart=/opt/denodo-solution-manager/bin/systemd/licensemanagerserver start

ExecStop=/opt/denodo-solution-manager/bin/systemd/licensemanagerserver stop

Environment=DENODO_HOME=/opt/denodo-solution-manager

Environment=JAVA_HOME=/opt/denodo-solution-manager/jre

Environment=PIDFILE=/opt/denodo-solution-manager/logs/licensemanager.pid

Environment=DENODO_PID_CHECK_PATTERN="DENODO_APP=Denodo Platform License Manager"

TimeoutSec=240

User=denodo

Group=denodo

[Install]

WantedBy=multi-user.target

solutionmanagerserver

#!/usr/bin/env bash

#

# Start/Stop the Denodo Solution Manager Server Daemon.

#

# Time to wait to...

T_WAIT_TO_STARTUP=20 # After startup

T_WAIT_TO_SHUTDOWN=40 # After shutdown

T_WAIT_TO_KILL=10 # After kill

. /opt/denodo-solution-manager/bin/systemd/denodo.properties

# Denodo service name

DENODO_SERVICE="Denodo Solution Manager"

# PIDFILE to block concurrent attemps to start the service

PIDFILE=${PIDFILE:-${DENODO_HOME}/logs/solutionmanager.pid}

# Pattern to check the process of the service

DENODO_PID_CHECK_PATTERN=${DENODO_PID_CHECK_PATTERN:-DENODO_APP=Denodo Platform Solution Manager}

# Service paths

DENODO_SM_START_SCRIPT="$DENODO_HOME/bin/solutionmanager_startup.sh"

DENODO_SM_STOP_SCRIPT="$DENODO_HOME/bin/solutionmanager_shutdown.sh"

DENODO_SRV_START_SCRIPT="$DENODO_HOME/bin/vqlserver_startup.sh"

DENODO_SRV_STOP_SCRIPT="$DENODO_HOME/bin/vqlserver_shutdonw.sh"

DENODO_WTOOL_START_SCRIPT="$DENODO_HOME/bin/solutionmanagerwebtool_startup.sh"

DENODO_WTOOL_STOP_SCRIPT="$DENODO_HOME/bin/solutionmanagerwebtool_shutdown.sh"

# Return Values

E_SUCCESS=0

E_BAD_PID=3

E_BAD_PARAM=4

# Function to get the pid of this service

get_pid() {

  local P=$(/bin/ps -fwwu $DENODO_USER | /bin/grep "$DENODO_PID_CHECK_PATTERN" | /bin/grep "$DENODO_HOME" | /bin/grep -v grep | /bin/awk '{print $2}')

  echo "$P"

}

start(){

  if [ -f $PIDFILE ]; then

    echo -n "$PIDFILE exists, process is already running or crashed\n"

   else

    # Block any other process attempt to launch the service

    /bin/touch $PIDFILE

    # Startup

    $DENODO_SRV_START_SCRIPT

    sleep $T_WAIT_TO_STARTUP

    $DENODO_SM_START_SCRIPT

    $DENODO_WTOOL_START_SCRIPT

    sleep $T_WAIT_TO_STARTUP

   

    # Get pid to write it to $PIDFILE

    local PID=$(get_pid)

   

    if [ -n $PID ] && (( $PID > 0 )) 2> /dev/null; then

      echo $PID >$PIDFILE

      RETURN_CODE=$E_SUCCESS

     else

      /bin/rm $PIDFILE

      RETURN_CODE=$E_BAD_PID

    fi

  fi

}

stop(){

  if [ ! -f $PIDFILE ]; then

    echo "$DENODO_SERVICE is not running."

   else

    # Shutdown

    $DENODO_WTOOL_STOP_SCRIPT

    $DENODO_SM_STOP_SCRIPT

    # Wait to capture the pid

    sleep $T_WAIT_TO_SHUTDOWN

          local PID=$(get_pid)

          if [ -n "$PID" ]; then # It still hasn't stopped

            echo "Termination $PID"        

            # Kill

      kill $PID

      sleep $T_WAIT_TO_KILL

            PID=$(get_pid)

            if [ -n "$PID" ]; then # It still hasn't stopped

        # Kill -9

        kill -9 $PID

                    echo "Abrupt termination"

      fi

    fi

    # Remove blocking file $PIDFILE so that it can be started again

    /bin/rm $PIDFILE

    RETURN_CODE=$E_SUCCESS

  fi

}

case "$1" in

    start)

        start

        ;;

    stop)

        stop

        ;;

    *)

        echo $"Usage: $0 {start|stop}"

        RETURN_CODE=$E_BAD_PARAM

esac

exit $RETURN_CODE

solutionmanagerserver.service

[Unit]

Description=Denodo Solution Manager Service

Wants=network-online.target licensemanagerserver.service

After=network-online.target licensemanagerserver.service

[Service]

Type=forking

PIDFile=/opt/denodo-solution-manager/logs/solutionmanager.pid

ExecStartPre=+/opt/denodo-solution-manager/lib/sh/denodo-init pre

ExecStart=/opt/denodo-solution-manager/bin/systemd/solutionmanagerserver start

ExecStop=/opt/denodo-solution-manager/bin/systemd/solutionmanagerserver stop

Environment=DENODO_HOME=/opt/denodo-solution-manager

Environment=JAVA_HOME=/opt/denodo-solution-manager/jre

Environment=PIDFILE=/opt/denodo-solution-manager/logs/solutionmanager.pid

Environment=DENODO_PID_CHECK_PATTERN="DENODO_APP=Denodo Platform Solution Manager"

TimeoutSec=240

User=denodo

Group=denodo

[Install]

WantedBy=multi-user.target

Note: It is possible to set up the Solution Manager to stop the Denodo Monitor when the Solution Manager is stopped or to keep the Denodo Monitor running.

This behavior is set by the configuration property com.denodo.solutionmanagerserver.monitoring.stopRunningMonitorsOnShutdown. If set to false the Denodo Monitor will not stop, this is the default setting in Denodo 8.

To stop the Denodo Monitor when the Solution Manager stops this property can be set to true (default setting in Denodo 7).

solutionmanagerwebtool.service

[Unit]

Description=Denodo Solution Manager Web Tools

BindsTo=solutionmanagerserver.service

After=solutionmanagerserver.service

[Service]

Type=oneshot

ExecStart=/opt/denodo-solution-manager/bin/webcontainer.sh start solution-manager-web-tool denodo-design-studio diagnostic-monitoring-tool webadmin/denodo-scheduler-admin

ExecStop=/opt/denodo-solution-manager/bin/webcontainer.sh stop solution-manager-web-tool denodo-design-studio diagnostic-monitoring-tool webadmin/denodo-scheduler-admin

Environment=DENODO_HOME=/opt/denodo-solution-manager

Environment=JAVA_HOME=/opt/denodo-solution-manager/jre

Environment=DENODO_CONF=$DENODO_HOME/resources/apache-tomcat/webapps/solution-manager-web-tool/WEB-INF/classes

RemainAfterExit=yes

KillMode=none

User=denodo

Group=denodo

[Install]

WantedBy=multi-user.target

Scripts for SysVinit

Solution Manager

#!/bin/sh

#

# solutionmanager Start/Stop the Solutionmanager Daemon.

#

# chkconfig: 345 90 60

# description:

DENODO_HOME="/opt/denodo_solution_manager"

# Source function library.

#. /etc/rc.d/init.d/functions

start(){

    if [ "$(rh_status)" = "1" ]; then

         echo "Solutionmanager is already alive"

    else

         $DENODO_HOME/bin/solutionmanager_startup.sh

    fi

}

stop(){

    if [ "$(rh_status)" = "1" ]; then

         $DENODO_HOME/bin/solutionmanager_shutdown.sh

    else

         echo "Solutionmanager is not running"

    fi

}

restart(){

    stop

    start

}

rh_status() {

    local P=$(ps -fea | grep "Denodo Platform Solution Manager" | grep -v grep)

    local ISALIVE="0"

    if [ -z "$P" ]; then

            ISALIVE="0"

    else

            ISALIVE="1"

    fi

    echo "$ISALIVE"

}

case "$1" in

    start)

         start

         ;;

    stop)

         stop

         ;;

    restart)

         restart

         ;;

    status)

         rh_status

         ;;

    *)

         echo $"Usage: $0 {start|stop|status|restart}"

         exit 2

esac

exit $?

License Manager

#!/bin/sh

#

# licensemanager Start/Stop the Licensemanager Daemon.

#

# chkconfig: 345 90 60

# description:

DENODO_HOME="/opt/denodo_solution_manager"

# Source function library.

#. /etc/rc.d/init.d/functions

start(){

    if [ "$(rh_status)" = "1" ]; then

         echo "Licensemanager is already alive"

    else

         $DENODO_HOME/bin/licensemanager_startup.sh

    fi

}

stop(){

    if [ "$(rh_status)" = "1" ]; then

         $DENODO_HOME/bin/licensemanager_shutdown.sh

    else

         echo "Licensemanager is not running"

    fi

}

restart(){

    stop

    start

}

rh_status() {

    local P=$(ps -fea | grep "Denodo Platform License Manager" | grep -v grep)

    local ISALIVE="0"

    if [ -z "$P" ]; then

            ISALIVE="0"

    else

            ISALIVE="1"

    fi

    echo "$ISALIVE"

}

case "$1" in

    start)

         start

         ;;

    stop)

         stop

         ;;

    restart)

         restart

         ;;

    status)

         rh_status

         ;;

    *)

         echo $"Usage: $0 {start|stop|status|restart}"

         exit 2

esac

exit $?

Solution Manager Web Admin Tool

#!/bin/sh

#

# Solution Manager Admin Tool Start/Stop.

#

# chkconfig: 345 90 60

# description: Solution Manager Administration Tool

DENODO_HOME="/path/to/denodo-solution-manager-8.0"

VDP_USER="vdp"

# Source function library.

#. /etc/rc.d/init.d/functions

start() {

   su -c "$DENODO_HOME/bin/solutionmanagerwebtool_startup.sh" $VDP_USER || return 0

}

stop() {

   $DENODO_HOME/bin/solutionmanagerwebtool_shutdown.sh

}

restart() {

   stop

   start

}

case "$1" in

   start)

          start

          ;;

   stop)

          stop

          ;;

   restart)

          restart

          ;;

   *)

          echo $"Usage: $0 {start|stop|restart}"

          exit 2

esac

exit $?

Questions

Ask a question

You must sign in to ask a question. If you do not have an account, you can register here