I simplified, and put some comments in the code for you......  

As for the log output, the user command is launched in the background. 
It's done that way, to let the pcp_startup.sh script exit normally, as
alot of folks just put commands that never exit in those areas.  I would
just leave it be, and understand that boot_log is not entirely
sequential.


Code:
--------------------
    
  #!/bin/sh
  
  # start pigpiod deamon
  pigpiod -t 0
  
  # wait for pigpiod to initialize - indicated by 'pigs t' returning a numeric 
value.  Returns 'socket connect failed' otherwise
  
  ###I Like to Capitalize variables, to make them stand out against 
programs/commands.
  PIGI=0
  while [ $PIGI -eq 0 ]
  do
        printf "\npigpiod initialization: "
        # No need to catch the output, or grep anything.  Just look at the pigs 
exit code.  Exit code '0' is everything is fine.
        pigs t >/dev/null 2>&1
        if [ $? -eq 0 ]; then
                PIGI=1
        else
                printf "\nWaiting for pigpiod to initialize"
                sleep 1
        fi
  done
  echo "pigpiod is running"
  
  # load uinput module - required to be able to send keystrokes
  .
  .
  .
--------------------



piCorePlayer a small player for the Raspberry Pi in RAM. 
Homepage: https://www.picoreplayer.org

Please 'donate'
(https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=U7JHY5WYHCNRU&lc=GB&currency_code=USD&bn=PP%2dDonationsBF%3abtn_donateCC_LG%2egif%3aNonHosted)
if you like the piCorePlayer
------------------------------------------------------------------------
paul-'s Profile: http://forums.slimdevices.com/member.php?userid=58858
View this thread: http://forums.slimdevices.com/showthread.php?t=111502

_______________________________________________
unix mailing list
[email protected]
http://lists.slimdevices.com/mailman/listinfo/unix

Reply via email to