User Tools

Site Tools


tsm:tsm_linux_start

Linux client startup scripts

For systemctl or services

dsmadmc.service

[Unit]
Description="IBM Spectrum Protect Client dsmcad systemd-style service."
After=local-fs.target network-online.target

[Service]
Type=forking
GuessMainPID=no
Environment="DSM_LOG=/opt/tivoli/tsm/client/ba/bin"
ExecStart=/usr/bin/dsmcad
ExecStopPost=/bin/bash -c 'let i=0; while [[ (-n "$(ps -eo comm | grep dsmcad)") && ($i -le 10) ]]; do let i++; sleep 1; done'
Restart=on-failure

[Install]
WantedBy=multi-user.target 

rc.dsmserv

#!/bin/sh
#
# (C) Copyright IBM Corporation 2011
#
# chkconfig: 35 95 5
# description: IBM Spectrum Protect Client Acceptor Daemon
#
### BEGIN INIT INFO
# Provides: dsmcad
# Required-Start: $local_fs $remote_fs $network
# Required-Stop:
# Default-Start: 3 5
# Default-Stop: 0 1 2 6
# Short-Description: IBM Spectrum Protect Client Acceptor Daemon
# Description: Start dsmcad to enable scheduler and Web GUI.
### END INIT INFO

DSMCAD_DIR=/opt/tivoli/tsm/client/ba/bin
DSMCAD_BIN=$DSMCAD_DIR/dsmcad
if [ ! -x $DSMCAD_BIN ]
then
   echo "$DSMCAD_BIN is not installed"
   if [ "$1" = "stop" ]
   then
      exit 0
   else
      exit 5
   fi
fi

if [ -f /etc/redhat-release ]
then
   SYSTEMCTL_SKIP_REDIRECT=1
   . /etc/init.d/functions

   start_()
   {
      echo -n "Starting dsmcad:"
      cd $DSMCAD_DIR
      daemon $DSMCAD_BIN
      echo
   }

   stop_()
   {
      echo -n "Stopping dsmcad:"
      killproc -d 10 $DSMCAD_BIN
      echo
      return $?
   }
   
   status_()
   {
      status $DSMCAD_BIN
   }

elif [ -f /etc/SuSE-release ]
then
   # Importing rc.status exports POSIX value for LC_ALL which later affects dsmcad behavior.
   # We need to save the initial value and restore it after doing the import.
   SAVE_LANG="$LANG"
   SAVE_LC_ALL="$LC_ALL"

   . /etc/rc.status

   rc_reset

   start_()
   {
      echo -n "Starting dsmcad:"
      cd $DSMCAD_DIR

      # Restore locale settings that was reset by rc.status script.
      export LANG="$SAVE_LANG"
      export LC_ALL="$SAVE_LC_ALL"

      startproc $DSMCAD_BIN
      rc_status -v
   }

   stop_()
   {
      echo -n "Stopping dsmcad:"
      killproc $DSMCAD_BIN
      rc_status -v
   }
   
   status_()
   {
      echo -n "Checking dsmcad:"
      checkproc $DSMCAD_BIN
      rc_status -v
   }

elif [ -f /etc/os-release ]
then
   . /etc/os-release

   if [ $NAME = "Ubuntu" ]
   then

      start_()
      {
         cd $DSMCAD_DIR
         if start-stop-daemon --status --exec $DSMCAD_BIN
         then
            echo "dsmcad is already running, pid" `pidof $DSMCAD_BIN`
         else
            if start-stop-daemon --start --exec $DSMCAD_BIN
            then
               echo "dsmcad is started, pid" `pidof $DSMCAD_BIN`
            else
               echo "dsmcad could not be started"
            fi
         fi
      }

      stop_()
      {
         if start-stop-daemon --status --exec $DSMCAD_BIN
         then
            if start-stop-daemon --stop --exec $DSMCAD_BIN
            then
               echo "dsmcad is stopped"
            else
               echo "dsmcad could not be stopped"
            fi
         else
            echo "dsmcad is not running"
         fi
      }

      status_()
      {
         if start-stop-daemon --status --exec $DSMCAD_BIN
         then
            echo "dsmcad is running, pid" `pidof $DSMCAD_BIN`
         else
            echo "dsmcad is not running"
         fi
      }

   fi

else
   echo "This distribution is not supported"
   exit 2
fi



case "$1" in
   start)
      start_
   ;;

   stop)
      stop_
   ;;

   restart)
      stop_
      sleep 2
      start_
   ;;

   status)
      status_
   ;;

   *)
      echo "Usage: $0 {start|stop|restart|status}"
      exit 1
   ;;
esac
tsm/tsm_linux_start.txt · Last modified: 2021/01/01 21:25 (external edit)