blog'o thnet

To content | To menu | To search

Tag - scheduler

Entries feed - Comments feed

Thursday 16 November 2006

How to Add a NewTSM Scheduler Daemon Service on RHEL4

  • dsmc sched represents the TSM scheduler daemon

Create the TSM service file:

# cat /etc/rc.d/init.d/tsm
#!/usr/bin/env sh

# chkconfig: 345 56 24
# description: TSM scheduler daemon
# processname: /usr/bin/dsmc

# Source functions library.
. /etc/rc.d/init.d/functions

LC_ALL=en_US; export LC_ALL
dsmc="/usr/bin/dsmc"
options="sched"
rc=0

start() {
  echo -n $"Starting `basename ${dsmc}`:"
  # Doesn't behave as expected because of the launching command
  # of the `tsm' scheduler :-(
  #initlog -c "${dsmc} ${options}  "    success || failure
  # So...
  [ -x ${dsmc} ]    (${dsmc} ${options}  ) > /dev/null 2> 1
  rc=$?
  if [ ${rc} -eq 0 ]; then
    success $"Starting `basename ${dsmc}`"
  else
    failure $"Starting `basename ${dsmc}`"
  fi
  echo
}

stop() {
  echo -n $"Stopping `basename ${dsmc}`:"
  if [ -n "`pidofproc ${dsmc}`" ]; then
    killproc ${dsmc} -TERM
  else
    failure $"Stopping `basename ${dsmc}`"
  fi
  rc=$?
  echo
}

case "$1" in
start)
  start
  ;;
stop)
  stop
  ;;
restart)
  stop
  start
  ;;
status)
  status ${dsmc}
  rc=$?
  ;;
*)
  echo "Usage: `basename $0` {start|stop|restart|status}"
  rc=1
  ;;
esac

exit ${rc}

Add and configure the TSM service:

# chmod 744 /etc/rc.d/init.d/tsm
# chkconfig --add tsm
# chkconfig --level 0126 tsm off
# chkconfig --level 345 tsm on

Start, or restart, the TSM service, and monitor it:

# service tsm restart
# service tsm status

Thursday 16 June 2005

How to Add a New "tsmsched" Service on AIX 5L

Create the tsmsched service:

# mkssys -p /usr/bin/dsmc \   /* Absolute path to the subsystem executable
                                 program. */
         -s tsmsched \        /* Name that uniquely identifies the subsystem. */
         -u 0 \               /* User id for the subsystem. */
         -a sched \           /* Arguments to be passed to the command. */
         -e /dev/console \    /* Where the subsystem standard error data is
                                 placed. */
         -i /dev/console \    /* Where the subsys. standard input is routed. */
         -o /dev/console \    /* Where the subsys. standard output is placed. */
         -R \                 /* Subsystem is restarted if the subsystem stops
                                 abnormally. */
         -Q \                 /* Multiple instances of the subsystem are not
                                 allowed to run at the same time. */
         -S \                 /* Subsystem uses the signals communication
                                 method. */
         -f 9 \               /* Signal sent to the subsystem when a forced
                                 stop of the subsystem is requested. */
         -n 15 \              /* Signal sent to the subsystem when a normal
                                 stop of the subsystem is requested. */
         -E 20 \              /* Execution priority of the subsystem. */
         -G tsm \             /* Subsystem belongs to the group specified. */
         -d \                 /* Inactive subsystems are displayed when the
                                 lssrc -a command request is made. */
         -w 20                /* Time, in seconds, allowed to elapse between a
                                 stop cancel (SIGTERM) signal and a subsequent
                                 SIGKILL signal. */

Check the service's configuration:

# lssrc -S -s tsmsched
#subsysname:synonym:cmdargs:path:uid:auditid:standin:standout:standerr:action:multi:contact:svrkey:svrmtype:\
 priority:signorm:sigforce:display:waittime:grpname:
tsmsched::sched:/usr/bin/dsmc:0:0:/dev/console:/dev/console:/dev/console:-R:-Q:-S:0:0:\
 20:15:9:-d:20:tsm:

Or directly querying the ODM internal database:

# odmget -q subsysname=tsmsched SRCsubsys

SRCsubsys:
        subsysname = "tsmsched"
        synonym = ""
        cmdargs = "sched"
        path = "/usr/bin/dsmc"
        uid = 0
        auditid = 0
        standin = "/dev/console"
        standout = "/dev/console"
        standerr = "/dev/console"
        action = 1
        multi = 0
        contact = 2
        svrkey = 0
        svrmtype = 0
        priority = 20
        signorm = 15
        sigforce = 9
        display = 1
        waittime = 20
        grpname = "tsm"

Start the new service:

# startsrc -s tsmsched

Launch the TSM scheduler at run-level #2:

# cat << EOF > /etc/rc.d/rc2.d/Stsmsched
#!/usr/bin/env ksh
###############################################################
# name: {K|S}tsmsched
# purpose: script that will start or stop the tsmsched service.
###############################################################

case "$1" in
start)
  startsrc -g tsm
  ;;
stop)
  stopsrc -g tsm
  ;;
*)
  echo "Usage: $0 {start|stop}"
  exit 1
esac

exit 0
EOF
# ln /etc/rc.d/rc2.d/Stsmsched /etc/rc.d/rc2.d/Ktsmsched
# chmod 744 /etc/rc.d/rc2.d/?tsmsched