1. Forum Rules (PLEASE CLICK HERE TO READ BEFORE POSTING) Click the link to access ADSM.ORG Acceptable Use Policy and forum rules which should be observed when using this website. Violators may be banned from this website. This message will disappear after you have made at least 12 posts. Thank you for your cooperation.

Linux SUSE - start/stop script problem (using PIDs)

Discussion in 'Scripting' started by John22439, Jan 7, 2009.

  1. John22439

    John22439 New Member

    Joined:
    Jan 3, 2007
    Messages:
    60
    Likes Received:
    0
    Hello all!

    I'm having some difficulty getting this script (from the Novell website) to kill ONLY the DSMCAD that I'm targeting.

    I have 2 scripts, one is for the GLOBAL file system (actually a shared file system) and one for the LOCAL node.

    Script 1: S99Tivoli_Local
    Script 2: S99Tivoli_Global

    I have 2 CADs running:

    DSMCAD_BIN=/opt/tivoli/tsm/client/ba/bin/dsmcad (the LOCAL script targets this one)
    DSMCAD_BIN=/usr/bin/dsmcad (the GLOBAL script targets this one)

    The start up scripts work and both have individual PIDs.

    I've altered both scripts to point to individual PID files... So that there is no conflict. (not sure if this is correct)

    DSMCAD_PIDFILE=/var/run/dsmcad.pid
    DSMCAD2_PIDFILE=/var/run/dsmcad2.pid

    When I have a problem with one of the CADs, I would like to target that CAD for a stop and start. When I run this script, it does not make use of the "PID" ... but kills ALL the DSMCADs.

    If you have any suggestions, or need more info, please post.

    Thanks,
    j





    Node_xyz:/etc/init.d # cat S99Tivoli_Local
    #!/bin/sh
    ### BEGIN INIT INFO
    # Provides: dsm
    # Required-Start: $network $syslog $remote_fs
    # Required-Stop: $network $syslog $remote_fs
    # Default-Start: 3 5
    # Default-Stop: 0 1 2 6
    # Description: Tivoli Storage Manager client acceptor daemon
    ### END INIT INFO

    # Check for existence of Binaries
    DSMCAD_BIN=/opt/tivoli/tsm/client/ba/bin/dsmcad

    test -x $DSMCAD_BIN || { echo "$DSMCAD_BIN not installed";
    if [ "$1" = "stop" ]; then exit 0;
    else exit 5; fi; }

    prog1="dsmcad"

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

    DSMCAD2_PIDFILE=/var/run/dsmcad2.pid

    . /etc/rc.status

    # First reset status of this service
    rc_reset

    case "$1" in
    start)
    echo -n $"Starting $prog1: "
    startproc -v -f -p $DSMCAD2_PIDFILE $DSMCAD_BIN -optfile=/opt/tivoli/tsm/client/ba/bin/dsm.opt >/dev/null 2>/dev/null
    rc_status -v
    ;;
    stop)
    echo -n $"Stopping $prog1: "
    killproc -v -p $DSMCAD2_PIDFILE -TERM $DSMCAD_BIN
    rc_status -v
    ;;
    restart)
    $0 stop
    $0 start
    rc_status
    ;;
    status)
    echo -n "Checking for DSMCAD"
    checkproc $DSMCAD_BIN
    rc_status -v
    ;;
    *)
    echo "Usage: $0 {start|stop|restart|status}"
    exit 1
    ;;
    esac
    rc_exit
     
  2.  
  3. John22439

    John22439 New Member

    Joined:
    Jan 3, 2007
    Messages:
    60
    Likes Received:
    0
    Sooo....

    I guess this one is "un-fixable"....

    j

    (bump)
     
  4. moon-buddy

    moon-buddy Moderator

    Joined:
    Aug 24, 2005
    Messages:
    6,257
    Likes Received:
    282
    Occupation:
    Electronics Engineer, Security Professional
    Location:
    Somewhere in the US
    The problem as I see it is identifying which dsmcad instance to shutdown unless you have some unique pointers as to which is local or global.

    One way around this, and maybe a more positive way of doing it, is to use the dsmc service rather than the dsmcad service to start either the local or global TSM instance.
     
  5. rore

    rore Senior Member

    Joined:
    Nov 27, 2005
    Messages:
    642
    Likes Received:
    15
    Occupation:
    SysAdmin
    Location:
    Montreal, CA
    Hi,
    killproc seems to be ignoring the PID (-p).

    Try this to confirm: start your two dsmcad, then on the terminal run: "killproc -v -p pid_of_first_dsmcad /opt/tivoli/tsm/client/ba/bin/dsmcad"

    If it kills both, you migth need a package patch for killproc. Or you can use kill instead of killproc.

    Rudy
     
: linux, suse

Share This Page