script looks ok to the msldigital.com guys and I received a tip to use a graceful shutdown script included in the picoreplayer release
If it's not in the default tinycore just use your shutdown script
I tried with less sudo and chown commands but I really had to do them all for all the commands to be accepted!
script can be placed in tc''s home directory and called from .profile
#! /bin/sh
# 22 is the GPIO pin receiving the shutdown signal
sudo chown tc /sys/class/gpio/export
echo "22" > /sys/class/gpio/export
sudo chown tc /sys/class/gpio/gpio22/direction
sudo chown tc /sys/class/gpio/gpio22/value
echo "in" > /sys/class/gpio/gpio22/direction
while true; do
sleep 1
power=$(cat /sys/class/gpio/gpio22/value)
if [ $power != 0 ]; then
echo "out" > /sys/class/gpio/gpio22/direction
echo "1" > /sys/class/gpio/gpio22/value
sleep 5
exitcheck.sh
fi
done