Created
November 11, 2012 01:10
-
-
Save white-gecko/4053244 to your computer and use it in GitHub Desktop.
Initscript to switch LED1 on Olinuxino A13 on and off
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment