I tried the previous script mentioned power off wd live lede but not fully working. Here is my detail result and info
Device
I'am running openwrt OpenWrt 19.07.1, 4.14.167 (builder@buildhost) (gcc version 7.5.0 (OpenWrt GCC 7.5.0 r10911-c155900f66))
My device is mybook live single (no usb slot) architecture APM821XX
Problem
shuting down the device/poweroff completely/not just reboot can't be done using command halt, poweroff , custom script post by
result : system off disc is spin off for 20s, system the automatically start in about 20s
For now this is now I do shutdown (halt/poweroff also works) also working script posted by @chunkeey
#!/bin/sh
echo 473 > /sys/class/gpio/export # This is GPIO1 on the GPIO-Controller at 0x4e0000000
echo out > /sys/class/gpio/gpio473/direction
echo 1 > /sys/class/gpio/gpio473/value # drive it high
poweroff
second script (softoff.sh need hdparm), I think this script is solution in lede but not in 19.07 posted by @chunkeey
result: system is off disc is still spinning, is not accessible via lan
( I dont have serial/console output), led is still green
#!/bin/sh
# soft-off program
# This program uses OpenWRT/LEDE's sysupgrade functionality to get
# a device into a "soft-off" state. This is because not all devices
# do have a working "poweroff" and if a user wants to unplug the
# device in order to move it. she/he might want this functionality.
# Currently, this script tries to put all attached harddrives into
# standby mode (which is why it requires hdparm) and tries to powers
# off all LEDs.
. /lib/functions.sh
. /lib/functions/system.sh
. /lib/upgrade/common.sh
HDPARM=$(command -v hdparm)
[ -z "$HDPARM" ] && {
(>&2 echo hdparm not installed.)
exit 1
}
case "$1" in
stage2)
for dev in /dev/sd*[a-z]; do
hdparm -y $dev
done
for leds in /sys/class/leds/*; do
echo 0 > $leds/brightness
done
while :; do
sleep 10000;
done
;;
*)
install_bin /sbin/upgraded
install_bin $0
install_bin /sbin/hdparm
ifdown -a
ubus call system sysupgrade "{
\"prefix\": $(json_string "$RAM_ROOT"),
\"path\": $(json_string "badfile"),
\"command\": $(json_string "$0 stage2")
}"
;;
esac
Both script was tried with original appolo3g.dtg and modeified apollo3g.dtg. I need to mention that after I replaced the original apollo3g.dtg and reboot, the boot folder is gone but the system boot just fine
root@OpenWrt:/boot# ls -alsh
4 drwxr-xr-x 2 root root 4.0K Jan 1 1970 .
4 drwxr-xr-x 18 root root 4.0K Jan 1 1970 ..
Not a problem
spin down using hd-idle ..it work just fine using timer
So..what to do now ?
thanks