Ten skrypt:
if [ "$BUTTON" = "wps" ] ; then
if [ "$ACTION" = "pressed" ] ; then
SW=$(crelay 1)
if [ "$SW" = "Relay 1 is on" ]; then
crelay 1 off
A=$(cat /tmp/tu-jest-pid)
[ -n "$A" ] && kill -9 $A
exit 0
fi
if [ "$SW" = "Relay 1 is off" ]; then
(crelay 1 on; sleep 600; crelay 1 off) &
echo $! > /tmp/tu-jest-pid
exit 0
fi
fi
fi
Powoduje, że zapisuje w temp numer procesu ale ten proces jak go podejrzę ma inny numer niż ten od sleep. I potem ten proces z tego numerku o nazwie:
{hotplug-call} /bin/sh /sbin/hotplug-call button
faktycznie zostaje ubity ale przekaźnik i tak działa. Dopiero jak dam kill i ten numer procesu tego sleep 600 to wówczas przekaźnik odpuszcza
Próbowałem zmodyfikować te skrypt na taki:
.......................................
(crelay 1 on; sleep 600; echo $! > /tmp/tu-jest-pid; crelay 1 off) &
Ale wówczas plik w tmp jest pusty 