blog'o thnet

To content | To menu | To search

Tag - Control-M

Entries feed - Comments feed

Thursday 23 November 2006

How to Add a New "ctmag" Service on RHEL4 (Control-M Agent v6)

Create the Control-M service file:

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

# chkconfig: 345 57 23
# description: Control-M agent daemons

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

LC_ALL=en_US; export LC_ALL
ctmag_user="ctmag620"
ctmag_home=`getent passwd ${ctmag_user} | awk -F\: '{print $6}'`
ctmag_opts="-u ${ctmag_user} -p ALL"
rc=0

start() {
  echo -n $"Starting `basename $0`:"
  initlog -c "${ctmag_home}/ctm/scripts/start-ag ${ctmag_opts}" > /dev/null \
   && success || failure
  echo
}

stop() {
  echo -n $"Stopping `basename $0`:"
  ${ctmag_home}/ctm/scripts/shut-ag ${ctmag_opts} > /dev/null
  rc=$?
  if [ ${rc} -eq 0 ]; then
    success $"Stopping `basename $0`"
  else
    failure $"Stopping `basename $0`"
  fi
  echo
}

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

exit ${rc}

Add and configure the Control-M service:

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

Start, or restart, the Control-M service:

# service ctmag restart

Tuesday 21 November 2006

How to Add a New "ctmag" Boot Script on AIX 5L (Control-M Agent v6)

Launch the Control-M agent at run-level #2:

# cat << EOF > /local/etc/init.d/ctmag
#!/usr/bin/env sh
########################################################################
# name: {K|S}ctmag
# purpose: script that will start or stop the Control-M agent processes.
########################################################################

ctmag_user="ctmag620"
#ctmag_home=`getent passwd ${ctmag_user} | awk -F\: '{print $6}'`
ctmag_home=`ypcat passwd | awk -F\: '$1 ~/'"${ctmag_user}"'/ {print $6}'`
ctmag_opts="-u ${ctmag_user} -p ALL"
rc=0

case "$1" in
start)
  ${ctmag_home}/ctm/scripts/start-ag ${ctmag_opts}
  ;;
stop)
  ${ctmag_home}/ctm/scripts/shut-ag ${ctmag_opts}
  ;;
* )
  echo "Usage: `basename $0` {start|stop}"
  rc=1
  ;;
esac

exit ${rc}
EOF
#
# chmod 744 /local/etc/init.d/ctmag
# ln /local/etc/init.d/ctmag /local/etc/rc2.d/Sctmag
# ln /local/etc/init.d/ctmag /local/etc/rcS.d/Kctmag
# ln /local/etc/init.d/ctmag /local/etc/rcshutdown.d/Kctmag

Start the new boot script:

# /local/etc/init.d/ctmag start
Control-M/Agent Listener started. pid: 237696
Control-M/Agent Tracker started. pid: 442610

Control-M/Agent started successfully.