Beispiel dsmcad-Skript

Das dsmcad-Skript sieht nach der Anpassung für Debian wie folgt aus:

#!/bin/sh
#
# (C) Copyright IBM Corporation 2011
#
# chkconfig: 35 95 5
# description: TSM 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: TSM 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
   . /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
      echo
      return $?
   }
   
   status_()
   {
      status dsmcad
   }

elif [ -f /etc/SuSE-release ]
then
   . /etc/rc.status

   rc_reset

   start_()
   {
      echo -n "Starting dsmcad:"
      cd $DSMCAD_DIR
      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" -o "$NAME" = "Debian GNU/Linux" ]
    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
Cookies helfen bei der Bereitstellung von Inhalten. Diese Website verwendet Cookies. Mit der Nutzung der Website erklären Sie sich damit einverstanden, dass Cookies auf Ihrem Computer gespeichert werden. Außerdem bestätigen Sie, dass Sie unsere Datenschutzerklärung gelesen und verstanden haben. Wenn Sie nicht einverstanden sind, verlassen Sie die Website. Weitere Information