Skip to content

Instantly share code, notes, and snippets.

@white-gecko
Created November 11, 2012 01:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save white-gecko/4053244 to your computer and use it in GitHub Desktop.
Save white-gecko/4053244 to your computer and use it in GitHub Desktop.
Initscript to switch LED1 on Olinuxino A13 on and off
#!/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