PDA

Bekijk de volledige versie : shutdown script



sonic
03-07-2008, 09:55
What script executed when i run
shutdown ?
i have latest kfurge *.nas firmware.

kfurge
05-07-2008, 14:45
What script executed when i run
shutdown ?
i have latest kfurge *.nas firmware.

Hitting the power button executes /sbin/miscio_input_change. I'm not sure if executing the "shutdown" command does too. In my latest builds, I've replaced Asus symlink with a script that hooks in rc.local (i.e. it runs "rc.local stop") at shutdown.

Here's my script:

#!/opt/bin/bash
#
# Copyright 2008, KFURGE
# All Rights Reserved.
#
# THIS SOFTWARE IS OFFERED "AS IS", AND KFURGE GRANTS NO WARRANTIES OF ANY
# KIND, EXPRESS OR IMPLIED, BY STATUTE, COMMUNICATION OR OTHERWISE. KFURGE
# SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS
# FOR A SPECIFIC PURPOSE OR NONINFRINGEMENT CONCERNING THIS SOFTWARE.
#

export PATH=/bin:/sbin:/usr/bin:/usr/sbin:/opt/bin:/opt/sbin

POWER=`cat /proc/miscio/soft_power_switch`
GPIO6=`cat /proc/miscio/gpio_6`

if [ "$GPIO6" = "1" ]; then
if [ -e /opt/etc/rc.local ]; then
/opt/etc/rc.local copy
fi
echo "0" > /proc/miscio/gpio_6
fi

if [ "$POWER" = "1" ]; then
if [ -e /opt/etc/rc.local ]; then
/opt/etc/rc.local stop
fi
rm -f /tmp/miscio_input_change
ln -s /sbin/rc /tmp/miscio_input_change
/tmp/miscio_input_change &
fi

exit 0


- K.C.