[Alix 2] Basic working solution to drive the front LEDs

Home Page Forums Network Management ZeroShell [Alix 2] Basic working solution to drive the front LEDs

This topic contains 1 reply, has 0 voices, and was last updated by  PatrickB 3 years, 10 months ago.

Viewing 1 post (of 1 total)
  • Author
    Posts
  • #44361

    PatrickB
    Member

    Hello.

    Sorry I still have no solution to make a front LED of the Alix show the network activity. ๐Ÿ˜ฅ

    But I could find a little program with some features and doctor it to provide the basic functions. This script is self-explanatory.

    I did not implement the CPU and disk activity, it would be easy to add. But my LED #2 is reserved for WAN activity, when I can do it… ๐Ÿ™„


    # set-alix-led.include.sh
    #
    # This script can be included by any script having to drive a LED on a Alix system.
    #
    # It relies on the very limited possibilities of the operator alix-leds that can be
    # found there: http://linux.1wt.eu/alix/util/
    # - the executable can be found in alix-leds-3.0-flx0.1-i386.tgz,
    # - the source file can be found in alix-leds-3.0.tgz (for real functionalities).
    #
    # Arguments:
    #
    # $1 = 1|2|3 (actually not verified, if you want to play, have fun...)
    # = the LED to operate. LED #1 is the leftmost, normally it is permanently lit on Alix.
    # $2 = on|off|slow|fast
    # = what to do: switch on, off or set to blinking slow or fast.

    ZtNicAlwaysUp="ETH01"
    ZtNicNotExisting="ETH666"

    SetLed() # $1 = 1|2|3, $2 = on|off|slow|fast
    {
    # Here is all what I can do with that poor operator 'alix-leds':
    # - start monitor an existing/unexisting NIC to tun the LED on/off,
    # - immediately kill the process become useless :-(
    # - for slow|fast blinking the process must remain,
    # - so it has to be killed first before any change.

    ZtPidFile="/tmp/SetLed$1.pid"
    if [ -f $ZtPidFile ]; then
    kill $(cat $ZtPidFile) ;
    rm -rf $ZtPidFile ;
    fi
    case "$2" in
    on)
    alix-leds -l $1 -i $ZtNicAlwaysUp -p $ZtPidFile ;
    kill $(cat $ZtPidFile) ;
    rm -rf $ZtPidFile ;
    ;;
    off)
    alix-leds -l $1 -i $ZtNicNotExisting -p $ZtPidFile ;
    kill $(cat $ZtPidFile) ;
    rm -rf $ZtPidFile ;
    ;;
    slow)
    alix-leds -l $1 -r -p $ZtPidFile ;
    ;;
    fast)
    alix-leds -l $1 -R -p $ZtPidFile ;
    ;;
    *)
    echo -e "set-alix-led.include.sh: SetLed( $1, $2) not implemented.n"
    ;;
    esac
    }

    The URL clickable: http://linux.1wt.eu/alix/util/

    See also this topic: https://www.zeroshell.org/forum/viewtopic.php?t=743 ๐Ÿ˜•

    Now I use this script in my project [Janus / twin Alix2] and it works very fine. ๐Ÿ˜€

    Hope it can help.
    .

Viewing 1 post (of 1 total)

You must be logged in to reply to this topic.