www.zeroshell.org Forum Index www.zeroshell.org
Linux Distribution for server and embedded devices
 
 SearchSearch  RegisterRegister  UsergroupsUsergroups 
 ProfileProfile  Log inLog in  Log in to check your private messagesPrivate Message 

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

 
Post new topic   Reply to topic    www.zeroshell.org Forum Index -> ZeroShell
View previous topic :: View next topic  
Author Message
PatrickB



Joined: 03 Nov 2012
Posts: 46

PostPosted: Wed Aug 19, 2015 7:34 pm    Post subject: [Alix 2] Basic working solution to drive the front LEDs Reply with quote

Hello.

Sorry I still have no solution to make a front LED of the Alix show the network activity. Crying or Very sad

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... Rolling Eyes

Code:

# 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: http://www.zeroshell.org/forum/viewtopic.php?t=743 Confused

Now I use this script in my project [Janus / twin Alix2] and it works very fine. Very Happy

Hope it can help.
.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    www.zeroshell.org Forum Index -> ZeroShell All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group