meta data for this page
  •  

A 'dsmcad' inittab-ba/init.d-be való betevése

AIX-en az inittab-ba, linux alatt az init.d-be tesszük.

dsmcad_mkinittab.sh
#!/bin/bash
### AIX inittab beallitas
# Megnezzuk nem letezik-e mar az inittab-ban a bejegyzes, letezik-e a dsmcad es AIX-on vagyunk-e
if [ `grep dsmcad /etc/inittab | wc -l` -eq 0 ] && [ -f /usr/bin/dsmcad ] && [ "$(uname)" = "AIX" ]; then
        # Megnezzuk mire mutat a symlink-je a dsmcad-nak, mert azt tesszuk az inittabba
        DSMCADPATH=`ls -l /usr/bin/dsmcad | awk '{print$NF}' | sed 's/\.\.\/\.\.//'`
        # Betesszuk az inittab-ba
        mkitab "dsmcad:2:once:$DSMCADPATH >/dev/console 2>&1"
        # Ha nem fut, akkor el is inditjuk
        if [ `ps ax | grep '[d]smcad$' | wc -l` -eq 0 ]; then $DSMCADPATH; fi
        exit 0
fi
 
### Linux init.d beallitas
# Ha nem Linuxon vagyunk, leallunk
[ "$(uname)" != "Linux" ] && exit 1;
# Ha TSM nincs kliens feltelepitve a gepre leallunk
[ `rpm -qa | grep -i tivsm | wc -l` -lt 2 ] && exit 1;
# Ha mar letezik az indito szkript, leallunk
if [ ! -f /etc/init.d/tsm ]; then
# Letrehozzuk az indito szkriptet
(
cat << 'EOT'
#!/bin/sh
#
# chkconfig: - 91 35
# description: Starts and stops TSM client acceptor daemon
#
#Source function library.
. /etc/rc.d/init.d/functions
 
[ -f /opt/tivoli/tsm/client/ba/bin/dsmc ] || exit 0
[ -f /opt/tivoli/tsm/client/ba/bin/dsmcad ] || exit 0
 
prog="dsmcad"
 
export DSM_DIR=/opt/tivoli/tsm/client/ba/bin
export DSM_CONFIG=/opt/tivoli/tsm/client/ba/bin/dsm.opt
 
start() {
echo -n $"Starting $prog: "
cd $DSM_DIR
daemon $DSM_DIR/dsmcad
RETVAL=$?
[ $RETVAL -eq 0 ] && touch /var/lock/subsys/dsmcad
return $RETVAL
}
 
stop() {
if test "x`pidof dsmcad`" != x; then
echo -n $"Stopping $prog: "
killproc dsmcad
echo
fi
RETVAL=$?
[ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/dsmcad
return $RETVAL
}
 
case "$1" in
start)
start
;;
 
stop)
stop
;;
 
status)
status dsmcad
;;
restart)
stop
start
;;
condrestart)
if test "x`pidof dsmcad`" != x; then
stop
start
fi
;;
 
*)
echo $"Usage: $0 {start|stop|restart|condrestart|status}"
exit 1
 
esac
 
exit 0
EOT
) > /etc/init.d/tsm
# Adunk neki execute jogot
  chmod 755 /etc/init.d/tsm
# Beallitjuk a futasi szinteket
  /sbin/chkconfig --add tsm
  /sbin/chkconfig --level 235 tsm on
  /sbin/chkconfig --list tsm
# Ha nem fut a dsmcad, elinditjuk
  [ `ps ax | grep '[d]smcad$' | wc -l` -eq 0 ] && /etc/init.d/tsm start
fi