返回列表 發帖

轉 IP01 LED

http://www.switchfin.org/index.p ... &Itemid=54#p804
A simple script to make the SYS LED Blink

Sys Led

Hello, this is a function to make blink SYS Led

Usefull anouncing asterisk status. or any other stuff
no "leds" pakage needed

FileName [sysled_blink.sh]
  1. #!/bin/hush
  2. STATE1=$1
  3. STATE1_udelay=$2
  4. STATE2=$3
  5. STATE2_udelay=$4
  6. times=$5

  7. while [ $times -gt 0 ]
  8. do
  9.         echo $STATE1 > /proc/sys_led
  10.         usleep $STATE1_udelay
  11.         echo $STATE2 > /proc/sys_led
  12.         usleep $STATE2_udelay
  13.         times=`expr $times - 1`
  14. done;
複製代碼
USE:
>/somewhere/sysled_blink.sh 1 100000 0 300000 4

sysled_blink.sh  FState FUdelay SState SUdelay Times
FState  1       first state   -  state 1-on 0-off
FUdelay 100000  number of u-seconds to sleep for first state
SState  0       second state  -  state 1-on 0-off
SUdelay 300000  number of u-seconds to sleep for second state
Times   4       times of blinking

返回列表