#!/bin/sh
#
# $Header: /home/th10af/backup/adsm/bin/RCS/dsm.sh,v 1.4 1996/08/15 09:03:50
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
#
# Author: Andreas Floeter, TI22
# $Date: 1996/08/15 09:03:50 $
## set environment variables
SNAME=$0
ADSMBIN=/usr/bin
ADMDIR=/var/adm
ADSMSPOOLDIR=$ADMDIR/adsm
DSM_LOG=$ADSMSPOOLDIR/dsmerror.log
STOP=true
export DSM_LOG
check_log_dir () {
if [ ! -d $ADMDIR ]; 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
ADSMBIN=/usr/bin
PS="ps ax"
PSFIELD=" cut -d' ' -f1"
plattform=digitialunix_v3
;;
AIX*1_4*)
DSM_DIR=/usr/lpp/adsm
ADSMBIN=/usr/bin
PS="ps ax"
PSFIELD="cut -d' ' -f 1,1"
plattform=aix_v4
;;
AIX*2_3*)
DSM_DIR=/usr/lpp/adsm
ADSMBIN=/usr/bin
PS="ps ax"
PSFIELD="cut -d\ -f1,1"
plattform=aix_v32
;;
SunOS*4.1*)
ADSMBIN=/bin
PS="ps ax"
PSFIELD="cut -f1,1 '-d ' "
plattform=sunos_v41
;;
SunOS*5.3*|SunOS*5.4*|SunOS*5.5*)
PS="ps -ef"
ADSMBIN=/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 $ADSMBIN/dsmc ]; then
echo "[$SNAME]: Error: Cannot execute '$ADSMBIN/dsmc' or file not
found."
echo "[$SNAME]: Terminating."
exit 1
fi
echo "Starting dsm ..." ;
case "$plattform" in
digitalunix_v3)
export DSM_LOG ; nohup $ADSMBIN/dsmc sched &
;;
*)
export DSM_LOG ; $ADSMBIN/dsmc sched &
esac
;;
'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×¾õßÏyã}üãN8ß?w
|