I've never really written shell scripts before, so tell me if this makes sense, probably badly hacked together from original LED script from RC5. Tell me if it's all logical and necessary. Supposed to make the white SES flash, the orange turn on, and then reboot the router.
mkdir /etc/hotplug.d
mkdir /etc/hotplug.d/button
touch /etc/hotplug.d/button/script
echo '#!/bin/sh
while : ; do
sleep 1
# Cisco button
if [ $BUTTON = "SES" && $ACTION = "Pressed" ]; then
logger "Rebooting (Reset button)"
echo "f" > /proc/diag/led/ses_white
echo "1" > /proc/diag/led/ses_orange
reboot
fi
done &' > /etc/hotplug.d/button/script
chmod a+x /etc/hotplug.d/button/script
(Last edited by napierzaza on 13 Nov 2006, 21:47)