Loading ...
Sorry, an error occurred while loading the content.

Re: startup file location for script fan_ctrl

Expand Messages
  • Don
    This is the fan script that I run on two different nodes and works well. Note down several lines where you have to add some lines to the rc.irlp file....... I
    Message 1 of 7 , Sep 19, 2011
    • 0 Attachment
      This is the fan script that I run on two different nodes and works well.
      Note down several lines where you have to add some lines to the rc.irlp file.......
      I think that will get things going for you.

      Don VE7EDA



      #!/bin/bash
      #########################################################################################
      #
      # filename: txfan
      #
      # description: This file controls a PC fan attached to any aux port. It starts up when
      # PTT is detected, and will stay on for the time period specified in
      # the TIMEAFTER variable after the PTT drops. If the PTT is triggered
      # in the countdown period, the timer resets.
      #
      # original authors: Thanks to KC6HUR, WW4M, N8DNX, NE1H for building the state manager framework, that
      # this script uses.
      #
      # Add the following code snipit near the end of rc.irlp.
      # This will restart the cos_watch process each time the
      # node is restarted.
      #
      # if [ -f ${CUSTOM}/txfan ] ; then
      # echo -n "Starting TXFAN process..."
      # killall txfan &>/dev/null
      # /bin/su - -c ${CUSTOM}/txfan repeater &>/dev/null &
      # echo "done!"
      # fi
      #
      # history:
      # 2005-02-16 kd6hwc Initial creation (with help from other scripts)
      #########################################################################################

      # Define the AUX Switch that the fan is connected to
      AUXPORT=3

      # Define the period of time after the PTT drops to shut off the fan
      TIMEAFTER=120

      # define variables
      declare -i IDLETIMER

      # need to set environment
      . /home/irlp/custom/environment

      # Make sure we are user repeater!!!
      if [ `/usr/bin/whoami` != "repeater" ] ;
      then
      echo This program must be run as user REPEATER!
      exit 1
      fi

      # Start with state set to "Initial"

      STATE="Initial"

      while [ TRUE ]
      do

      case "$STATE" in


      "Initial") # Wait for first keyup, then proceed to Countdown

      echo -en "\n\n"`date ` "STATE = Initial\n"

      # while IRLP board is silent (PTT=T)
      while $BIN/pttstate ; do
      sleep 1
      done

      echo -en "\nPTT keyed, activating fan"
      ${BIN}/aux"$AUXPORT"on
      STATE="Countdown"
      ;;


      "Countdown") # Count down period, if PTT is triggered, reset the timer.

      echo -en "\n\n"`date ` "STATE = Countdown\n"
      sleep 1
      IDLETIMER=$TIMEAFTER

      while [ TRUE ]
      do
      echo -en "\rWaiting for Countdown: $IDLETIMER "
      IDLETIMER=$IDLETIMER-1
      sleep 1

      if ! $BIN/pttstate
      then
      IDLETIMER=$TIMEAFTER
      fi

      if [ $IDLETIMER = 0 ]
      then
      break
      fi
      done

      echo -en "\nTimer expired, deactivating fan"
      ${BIN}/aux"$AUXPORT"off
      STATE=Initial
      ;;

      esac
      done

      echo -e "\n\nOops! - Not supposed to get to here"

      ########################





      --- In irlp-embedded@yahoogroups.com, "k7iiv" <k7iiv@...> wrote:
      >
      > I in the process of using the fan_ctrl script for aux3 I have put the script. And edited the three lines in rc.irlp I put the script in the node at: /home/irlp/custom/ (here is where I put the script) fan_ctrl If I run the script it works fine. But it wont srun on its own. I believe it is not in a startup file. Also I read I will need a relay for the fan . Anyone that is using this , I would appreciate a breakdown on how this is done.
      >
      > Alan
      >
      > Node 3679
      >
      > K7IIV
      >
    • tentecorion
      ... I guess I must be stupid but i have had no luck in geting this script to work. Here s what I did I placed this at the end of rc.irlp: # Controls TX Fan if
      Message 2 of 7 , Mar 15 8:20 PM
      • 0 Attachment
        --- In irlp-embedded@yahoogroups.com, "Don" <donmor46@...> wrote:
        >
        > This is the fan script that I run on two different nodes and works well.
        > Note down several lines where you have to add some lines to the rc.irlp file.......
        > I think that will get things going for you.
        >
        > Don VE7EDA
        >
        >
        >
        I guess I must be stupid but i have had no luck in geting this script to work. Here's what I did"

        I placed this at the end of rc.irlp:

        # Controls TX Fan
        if [ -f ${CUSTOM}/txfan ] ; then
        echo -n "Starting TXFAN process..."
        killall txfan &>/dev/null
        /bin/su - -c ${CUSTOM}/txfan repeater &>/dev/null &
        echo "done!"
        fi


        Then I created a file named txfan and placed it in /home/irlp/custom put all this in it:

        # Define the AUX Switch that the fan is connected to
        AUXPORT=3

        # Define the period of time after the PTT drops to shut off the fan
        TIMEAFTER=300

        # define variables
        declare -i IDLETIMER

        # need to set environment
        . /home/irlp/custom/environment

        # Make sure we are user repeater!!!
        if [ `/usr/bin/whoami` != "repeater" ] ;
        then
        echo This program must be run as user REPEATER!
        exit 1
        fi

        # Start with state set to "Initial"

        STATE="Initial"

        while [ TRUE ]
        do

        case "$STATE" in


        "Initial") # Wait for first keyup, then proceed to Countdown

        echo -en "\n\n"`date ` "STATE = Initial\n"

        # while IRLP board is silent (PTT=T)
        while $BIN/pttstate ; do
        sleep 1
        done

        echo -en "\nPTT keyed, activating fan"
        ${BIN}/aux"$AUXPORT"on
        STATE="Countdown"
        ;;


        "Countdown") # Count down period, if PTT is triggered, reset the timer.

        echo -en "\n\n"`date ` "STATE = Countdown\n"
        sleep 1
        IDLETIMER=$TIMEAFTER

        while [ TRUE ]
        do
        echo -en "\rWaiting for Countdown: $IDLETIMER "
        IDLETIMER=$IDLETIMER-1
        sleep 1

        if ! $BIN/pttstate
        then
        IDLETIMER=$TIMEAFTER
        fi

        if [ $IDLETIMER = 0 ]
        then
        break
        fi
        done

        echo -en "\nTimer expired, deactivating fan"
        ${BIN}/aux"$AUXPORT"off
        STATE=Initial
        ;;

        esac
        done

        echo -e "\n\nOops! - Not supposed to get to here"


        I then flash_sync and reboot.

        At the end of boot it echoed "Starting TXFAN process"...."Done"

        When the transmitter activates I get no AUX light.

        Does anyone have a clue what I am doing wrong?

        Thanks,

        Tom NJ1K
      • tentecorion
        OK, I did finally get the script to run, but only if I manuall start it. It doesn t seem to wantr to start itself when that server starts.
        Message 3 of 7 , Mar 16 5:26 AM
        • 0 Attachment
          OK, I did finally get the script to run, but only if I manuall start it. It doesn't seem to wantr to start itself when that server starts.
        • AG0N-3055
          ... I didn t look through the actual script in your note to see if you had any problems in it (just woke up), but you don t say how long the transmitter was
          Message 4 of 7 , Mar 16 5:35 AM
          • 0 Attachment
            On Fri, 16 Mar 2012 03:20:17 -0000, tentecorion wrote:

            > I guess I must be stupid but i have had no luck in geting this script to work. Here's what I did"

            I didn't look through the actual script in your note to see if you had
            any problems in it (just woke up), but you don't say how long the
            transmitter was keyed before you declared it not working. The script
            does not start the fan immediately upon keyup. It assumes a fan is not
            needed for short key periods. I believe that period is settable in the
            script, and I think I run 30 seconds or so on mine.

            Sorry if I missed something and this doesn't help.

            Gary
            --
            http://ag0n.net
            3055: http://ag0n.net/irlp/3055
            NodeOp Help Page: http://ag0n.net/irlp
          • tentecorion
            ... OK, it seems permissions was the reason I could not get it to run manually. I got that fixed. Then it didn t like lines 28 and 51: 28:
            Message 5 of 7 , Mar 16 5:58 AM
            • 0 Attachment
              --- In irlp-embedded@yahoogroups.com, AG0N-3055 <mcduffie@...> wrote:
              >
              > On Fri, 16 Mar 2012 03:20:17 -0000, tentecorion wrote:
              >
              > > I guess I must be stupid but i have had no luck in geting this script to work. Here's what I did"
              >
              > I didn't look through the actual script in your note to see if you had
              > any problems in it (just woke up), but you don't say how long the
              > transmitter was keyed before you declared it not working. The script
              > does not start the fan immediately upon keyup. It assumes a fan is not
              > needed for short key periods. I believe that period is settable in the
              > script, and I think I run 30 seconds or so on mine.
              >
              > Sorry if I missed something and this doesn't help.
              >
              > Gary
              > --
              > http://ag0n.net
              > 3055: http://ag0n.net/irlp/3055
              > NodeOp Help Page: http://ag0n.net/irlp
              >

              OK, it seems permissions was the reason I could not get it to run manually. I got that fixed. Then it didn't like lines 28 and 51:

              28: ${BIN}/aux"$AUXPORT"on
              51 ${BIN}/aux"$AUXPORT"off

              The macnihe interpreted these as auxauxport. I removed aux and now it runs fine but will not run the script automatically when the machine boots.

              Any help appreciated
              Tom NJ1K
            • tentecorion
              Ok, nevermind, I goty it all taken care of... Tom NJ1K
              Message 6 of 7 , Mar 17 6:56 PM
              • 0 Attachment
                Ok, nevermind, I goty it all taken care of...

                Tom

                NJ1K
              Your message has been successfully submitted and would be delivered to recipients shortly.