Thursday, November 23rd 2017, 3:57pm UTC+1

You are not logged in.

  • Login
  • Register

Dear visitor, welcome to NAS Forum. If this is your first visit here, please read the Help. It explains how this page works. You must be registered before you can use all the page's features. Please use the registration form, to register here or read more information about the registration process. If you are already registered, please login here.

AQUAR

Trainee

Posts: 100

Location: Australia

1

Wednesday, February 1st 2012, 12:37am

Button Script For MBox

Button Script For MBox (and clones)


The OpenWRT port for the MBox has the hotplug package installed by default.
This package can provide for button control by simple scripts in the /etc/hotplug.d/button/
follder.

In this folder there is already a script called 01-button (with commented out lines).
Replace the contents of this script with the code below, to set the upper button for a
firmware shutdown and the lower button for a system reboot

Code:

#!/bin/sh

if [ "$BUTTON" = "BTN_0" ] && [ "$ACTION" = "released" ] && [ $SEEN -gt "5" ] ; then
exec kill -USR1 1
fi
if [ "$BUTTON" = "BTN_1" ] && [ "$ACTION" = "released" ] && [ $SEEN -gt "5" ] ; then
reboot
fi

End Code:

There is more information on the OpenWRT site (http://wiki.openwrt.org/doc/howto/hardware.button), including a script called
"Atheros' 00-button + UCI" that integrates button control into the UCI system. This script works fine on the MBox.



Aquar