Call hciprocstaus from script

Clovertech Forums Cloverleaf Call hciprocstaus from script

  • Creator
    Topic
  • #120127
    RICK L. PRITCHETT
    Participant

      I am trying to call hciprocstatus in an alert using a script.  Below I believe I am setting up the env variables correctly.

      #!/usr/bin/bash

      #set hciRoot /hci/cis19.1/integrator

      eval $HCIROOT/sbin/hcisetenv -root ksh > /dev/null

      site=$1

      process=$2

      site=basename $site

      #echo $site

      eval $HCIROOT/sbin/hcisetenv -site ksh $site > /dev/null

      showroot

      /hci/cis19.1/integrator/scripts/alert_scripts/start_process.tcl $site $process

       

      start of proc called.  I get this in the log file:  Unable to contact hcimonitord: timed out

      start_process.tcl

      #!/usr/bin/env hcitcl

      set site [lindex $argv 0]

      set process [lindex $argv 1]

      append filename_cmd3 $process _cmd_output3.txt

      hciprocstatus -p %P -i > /hci/cis19.1/integrator/scripts/alert_scripts/%P_cmd_output3.txt

      to test it I have an alert that is set up as an exec that does return the output

      hciprocstatus -p %P -i > /hci/cis19.1/integrator/scripts/alert_scripts/%P_cmd_output.txt

       

      any ideas?

       

       

    Viewing 2 reply threads
    • Author
      Replies
      • #120128
        Peter Heggie
        Participant

          It looks real close to what we do.

          We do a setroot <path to “integrator” folder>

          Then the setsite.

          Then issue the start process command.

          Then go into a loop and wait for the status to be running:

          # wait for process to start
          twait=0
          sprocess=printf "%.15s" "$process"
          tstat=hciprocstatus -p $process |grep $sprocess | awk '{ print $2 }'
          while [ “$tstat” != “running” ]
          do
          sleep 2 ; twait=expr $twait + 2
          if [ $twait -gt $waitseconds ]; then break ; fi
          tstat=hciprocstatus -p $process |grep $sprocess | awk '{ print $2 }'
          done

          # did we ever get a status?
          if [ “$tstat” = “running” ]; then
          out=”started $process”
          rcode=0
          else
          if [ -z “$out” ] ; then
          out=”hciconnstatus | grep $sprocess error starting $process”
          fi
          rcode=8
          fi

          Peter Heggie
          PeterHeggie@crouse.org

        • #120129
          RICK L. PRITCHETT
          Participant

            I tried part of your code and I am getting an error on the -p argument.  I have tried encapsulating the hciprocstatus -p $process in single quotes, double quotes and the different brackets.

            tstat=hciprocstatus -p $process |grep $sprocess | awk ‘{ print $2 }’

            /hci/cis19.1/integrator/scripts/alert_scripts/setsite_alerts.sh: line 20: -p: command not found

          • #120130
            RICK L. PRITCHETT
            Participant

              Ok, I re-started the daemons and now get a time-out.  Unable to contact hcimonitord: timed out

              I noticed the lock manager restarted with the same PID.  Could this be an issue?

          Viewing 2 reply threads
          • You must be logged in to reply to this topic.