public
Created

Initscript to switch LED1 on Olinuxino A13 on and off

  • Download Gist
statusled
Shell
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37
#!/bin/bash
#
# Initscript to switch LED1 on Olinuxino A13 on and off
#
### BEGIN INIT INFO
# Provides: statusled
# Required-Start: $remote_fs $syslog
# Required-Stop: $remote_fs $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: On/Off script for LED1
# Description: This script switch the LED1 on if it starts and off if it stops
### END INIT INFO
 
LED_DEV=/sys/devices/virtual/misc/sun4i-gpio/pin/pg9
RET_VAL=0
 
case "$1" in
start)
echo '1' > $LED_DEV
;;
stop)
echo '0' > $LED_DEV
;;
restart)
echo '0' > $LED_DEV
echo '1' > $LED_DEV
;;
status)
echo "For me its like Schrödinger's cat, but you could take a look."
;;
*)
echo "Usage: statusled {start|stop|restart|status}"
RET_VAL=1
;;
esac
exit $RET_VAL

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.