Create an init script.
Use "chkconfig" to enable and disable
Use "service" to stop start status

The following Is an ok starting point
https://www-304.ibm.com/support/docview.wss?uid=swg21358414

I have a server that runs multiple dsmcads at once and created a more
flexible version attached

HTH

Grant

On 12/05/15 16:20, Grigori Solonovitch wrote:
In AIX I am using " nohup /usr/bin/dsmcad &"

Grigori Solonovitch, Senior Systems Architect, IT, Ahli United Bank Kuwait, 
www.ahliunited.com.kw

-----Original Message-----
From: ADSM: Dist Stor Manager [mailto:ADSM-L@VM.MARIST.EDU] On Behalf Of 
madu...@gmail.com
Sent: 12 05 2015 8:24 AM
To: ADSM-L@VM.MARIST.EDU
Subject: [ADSM-L] Automatic startup of dsmcad daemon

Good Day,

I would like to have automatic startup of dsmcad daemon on system reboot on Red 
Hat Linux, would be this the best approach:
cad::once:/opt/tivoli/tsm/client/ba/bin/dsmcad >/dev/null 2>&1 # TSM Webclient

-mad


Please consider the environment before printing this Email.

________________________________

CONFIDENTIALITY AND WAIVER: The information contained in this electronic mail 
message and any attachments hereto may be legally privileged and confidential. 
The information is intended only for the recipient(s) named in this message. If 
you are not the intended recipient you are notified that any use, disclosure, 
copying or distribution is prohibited. If you have received this in error 
please contact the sender and delete this message and any attachments from your 
computer system. We do not guarantee that this message or any attachment to it 
is secure or free from errors, computer viruses or other conditions that may 
damage or interfere with data, hardware or software.




#!/bin/sh
#
# Taken from https://www-304.ibm.com/support/docview.wss?uid=swg21358414
# start and stop the client daemon for a node
# Fixed so multiple could be run at once
#
# To create a new node
# 1. Create the node definition in the dsm.sys
# 2. Create an opt file called <node name lowercase>.opt
# 3. Copy this file to /etc/init.d/dsmcad-<node name lowercase>
# 4. chkconfig --add dsmcad-<node name lowercase>
# 5. service dsmcad-<node name lowercase> start
#
# chkconfig: 345 93 35
# description: Starts and stops TSM client acceptor daemon
#
# added new chkconfig
### BEGIN INIT INFO
# Provides: 
# Required-Start: $local_fs $network $remote_fs $autofs
# Required-Stop: $local_fs $network $remote_fs $autofs
# Default-Start:   3 4 5
# Default-Stop: 0 1 2 6
# Short-Description: TSM infr Instance
# Description: Tivoli Storage Manager Infrastructure Instance
### END INIT INFO

#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"

service=`basename $0`

# see if $0 starts with Snn or Knn, where 'n' is a digit.  If it does, then
# strip off the prefix and use the remainder as the instance name.
if [[ ${service:0:1} == S ]]
then
  service=${service#S[0123456789][0123456789]}
elif [[ ${service:0:1} == K ]]
then
  service=${service#K[0123456789][0123456789]}
fi


node=${service#dsmcad-}
pidfile=/var/run/${service}.pid

export DSM_DIR=/opt/tivoli/tsm/client/ba/bin
export DSM_CONFIG=/opt/tivoli/tsm/client/ba/bin/$node.opt

# To not skip  unrecognized characters during sched or web client backups
export LANG=en_AU
export LC_ALL=en_AU

start() {
  echo -n $"Starting $prog for tsm node $node: "
  cd $DSM_DIR
  daemon $DSM_DIR/dsmcad -optfile=$DSM_CONFIG
  echo
#  echo daemon $DSM_DIR/dsmcad 
  RETVAL=$?
  [ $RETVAL -eq 0 ] && touch /var/lock/subsys/$service && ps -fe |grep -v grep 
|grep "$DSM_DIR/dsmcad -optfile=$DSM_CONFIG" |awk '{print $2}' > $pidfile
  return $RETVAL
}

stop() {
  if [ -f $pidfile ] ; then
    echo -n $"Stopping $prog for tsm node $node: "
    killproc -p $pidfile $prog
#    echo killproc dsmcad
    echo
  else 
    echo -n "$service not running"
    echo
  fi
  RETVAL=$?
  [ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/$service && rm  -f $pidfile
  return $RETVAL
}

case "$1" in
start)
start
;;

stop)
stop
;;

status)
status -p $pidfile $prog
;;
restart)
stop
start
;;
condrestart)
if [ -f /var/lock/subsys/$service ] ; then
  stop
  start
else 
  echo "$service not running"
fi
;;

*)
echo $"Usage: $0 {start|stop|restart|condrestart|status}"
exit 1

esac

exit 0

Reply via email to