That works perfectly, thanks Greg, and Greg :-)
If I run this as a user script (without sudo), rather than as a start-up
user command, then pigpiod doesn't start, so I get the 10 second
time-out. If I run it with sudo then it initialises after the first
loop though, i.e. it takes a second to initialise.
Code:
--------------------
#!/bin/sh
# start pigpiod daemon
pigpiod -t 0 -f -l -s 10
# wait for pigpiod to initialize - indicated by 'pigs t' exit code of zero
#while ! pigs t >/dev/null 2>&1 ; do
# printf "\nWaiting for pigpiod to initialize\n"
# sleep 1
#done
#printf "\npigpiod is running\n"
count=10 # approx time limit in seconds
while ! pigs t >/dev/null 2>&1 ; do
if [ $((count--)) -le 0 ]; then
printf "\npigpiod failed to initialize within time limit\n"
exit 1 # or however you want to deal with failure
fi
# printf "\nWaiting for pigpiod to initialize\n"
sleep 1
done
printf "\npigpiod is running\n"
--------------------
------------------------------------------------------------------------
chill's Profile: http://forums.slimdevices.com/member.php?userid=10839
View this thread: http://forums.slimdevices.com/showthread.php?t=111502
_______________________________________________
unix mailing list
[email protected]
http://lists.slimdevices.com/mailman/listinfo/unix