ADSM-L

[no subject]

2015-10-04 18:12:49
#!/bin/sh
#
# $Header: /backup/adsm/bin/RCS/dsm.sh,v 1.8 1996-09-03 15:42:44+02 th10af Exp $
#
# Purpose: Start or stop of dsm scheduler (ADSM)
#
# Diese Skript soll den "dsmc sched" auf ADSM Clients starten. Es ist als ein
# rc-Skript konzepiert, dass waehrend des Boot-Vorgangs in der Boot-Folge mit
# dem Parameter "start" aufgerufen wird. Da der "dsmc sched" mit einen
# normalen kill-Signal terminiert werden kann, braucht es nicht in einer
# shutdown-Folge eingebaut sein.
#
# Moechte man den Scheduler terminieren, kann man dies mit dem Aufruf
# "<scriptname> stop" tun.
# 
# Installation:
#
# 
# SunOS 4.1.x
#  o install in /etc/dsm.sh
#  o chmod 755 /etc/dsm.sh
#  o append the following lines to /etc/rc.local
#    ### ADSM scheduler startup
#    if [ -x /etc/dsm.sh ]; then
#       /etc/dsm.sh start
#    else
#       echo "Error: Cannot execute ADSM scheduler ('/etc/dsm.sh')."
#    fi
#
#
# Solaris 2.x
#  o install in /etc/init.d/dsm.sh
#  o ln /etc/init.d/dsm.sh /etc/rc2.d/S99dsm
#  o chmod 755 /etc/init.d/dsm.sh /etc/rc2.d/S99dsm
#
# 
# AIX 4.1.4
#  o install in /etc/dsm.sh
#  o letzter Eintrag in /etc/inittab:
#    dsmsched:2:once:/etc/dsm.sh start >/dev/console 2>&1 #Start the ADSM 
scheduler
#  o chmod 755 /etc/dsm.sh
#
# 
# HP-UX 9.x
#  o install in /etc/dsm.sh
#  o chmod 755 /etc/dsm.sh
#  o insert lines
#    ##[
#    ## Start the ADSM backup daemon
#    /etc/dsm.sh start
#
#    ##]
#    into /etc/netlinkrc prior to
#    ##[
#    # return exit code for Instant Ignition
#    if [ $net_init -eq 0 ]
#    then
#      exit 0
#    else
#      exit 1
#    fi
#    ##]

# Author: Andreas Floeter, TI22
# $Date: 1996-09-03 15:42:44+02 $

trap "" 1 3

## set environment variables
SNAME=$0
ADSMDIR=/usr/bin
ADMINSPOOLDIR=/var/adm
ADSMSPOOLDIR=$ADMINSPOOLDIR/adsm
DSM_LOG=$ADSMSPOOLDIR/dsmerror.log
STOP=true

export DSM_LOG

check_log_dir () {

  if [ ! -d $ADMINSPOOLDIR ]; then
     echo "[$SNAME]: Missing log file directory '$ADMVAR'. Terminating."
     echo "[$SNAME]: Check if this directory should exist, create it if"
     echo "[$SNAME]: missing, or change this startup procedure."
     echo "[$SNAME]: Terminating."

     exit 1
  fi

  if [ ! -d $ADSMSPOOLDIR ]; then

     echo "[$SNAME]: Creating ADSM log spool directory."
     mkdir $ADSMSPOOLDIR

     if [ ! -d $ADSMSPOOLDIR ]; then
        echo "[$SNAME]: Unable to create ADSM log spool directory."
        echo "[$SNAME]: Terminating."
     fi

  fi

}

## determine the plattform running on
PLATTFORM=`uname -a|sed 's@ @_@g'`

case "$PLATTFORM" in

  OSF1*V3.*)   
       DSM_DIR=/usr/opt/adsm
       ADSMDIR=/usr/bin
       PS="ps ax" 
       PSFIELD=" cut -d' ' -f1"
       plattform=digitialunix_v3
       ;;

  AIX*1_4*)  
       DSM_DIR=/usr/lpp/adsm
       ADSMDIR=/usr/bin
       PS="ps ax" 
       PSFIELD="cut -d' ' -f 1,1"
       plattform=aix_v4
       ;;

  AIX*2_3*)  
       DSM_DIR=/usr/lpp/adsm
       ADSMDIR=/usr/bin
       PS="ps ax" 
       PSFIELD="cut -d\  -f1,1"
       plattform=aix_v32
       ;;

  HP-UX*09*)  
       DSM_DIR=/usr/adsm
       ADSMDIR=/usr/bin
       PS="ps -ef" 
       PSFIELD="cut -d' ' -f 2,2"
       plattform=hpux_v9
       ;;

  HP-UX*10*)  
       DSM_DIR=/usr/adsm
       ADSMDIR=/usr/bin
       PS="ps -ef" 
       PSFIELD="cut -d' ' -f 2,2"
       plattform=hpux_v10
       ;;

  SunOS*4.1*)    
       ADSMDIR=/bin
       PS="ps ax" 
       PSFIELD="cut -f1,1 '-d ' "
       plattform=sunos_v41
       ;;

  SunOS*5.3*|SunOS*5.4*|SunOS*5.5*) 
       PS="ps -ef"
       ADSMDIR=/usr/sbin
       PSFIELD="cut -f2,2 '-d ' "
       plattform=solaris_v2
       ;;

  *)   DSM_DIR= 
       STOP=false
       ;;

esac

case "$#" in
    1) ;;
    *) echo "[$SNAME]: Error: Missing parameter, either 'start' or 'stop' 
expected."
    echo "[$SNAME]: Terminating."
    exit 1;;
esac

case "$1" in
'start')
        check_log_dir
        # Start of the ADSM client scheduler
        if [ ! -x $ADSMDIR/dsmc ]; then
           echo "[$SNAME]: Error: Cannot execute '$ADSMDIR/dsmc' or file not 
found."
           echo "[$SNAME]: Terminating."
           exit 1
         fi


        echo "Starting dsm ..." ; 
        export DSM_LOG ;  $ADSMDIR/dsmc sched &         
    ;;

'stop')
        # No need to stop the ADSM client scheduler
       if [ $STOP = false ]; then
          echo "[$SNAME]: No stopping possible for this platform [$PLATTFORM]."
          echo "[$SNAME]: Terminating."
          exit 1
       fi

       PROCLIST="`$PS|grep 'dsmc sched'|grep -v grep|sed -e 's@  *@ @g' -e 's@^ 
@@'|eval $PSFIELD`"

       if [ "$PROCLIST" != "" ]; then
          kill $PROCLIST
       else
          echo "[$SNAME]: No 'dsmc sched' process is running."
       fi
    ;;
     *) echo "Error: Unknown parameter '$1' [cmdline='$*'].";;
esac

×;×_8׿;׿9×?|㮹ó®ô
<Prev in Thread] Current Thread [Next in Thread>
  • [no subject], Unknown <=