chill wrote: 
> That's useful.  So starting and stopping squeezelite should be
> straightforward within the script (stopping is obviously done within the
> 'stop' section, and starting is done within the while loop in the
> SQLITErestart() function at the top).  The only tricky thing will be the
> 'condition' for continuing that loop.  
> 
> Currently that 'while' condition is:
> > 
Code:
--------------------
  >   > while [ "$(sudo /usr/local/etc/init.d/squeezelite status)" == 
"Squeezelite not running." ]; do
--------------------
> > 
> 
> In your case I think you'll have to do something with grep and/or awk
> to look for "active (running)" within the response to the status
> request.  Or maybe the status request returns a true/false result that
> you could test instead.

Yes I did also notice this. I changed the while loop so it would use
wildcards:

Code:
--------------------
    while [ "$(dietpi-services status squeezelite)" == *"inactive (dead)"* ]; do
--------------------


Retrieving the PID is obviously not going to work, because the status
message doesn't contain the PID. So I changed it into this:

Code:
--------------------
     # determine cardname from squeezelite process id
  local PID=$(ps ax | pgrep squeezelite)
  local cardname=$(ps | grep $PID | awk -F CARD= {'print $2'} | awk -F , 
{'print $1'})
--------------------


I might also need to change the command to get the card name, but I
don't have time right now to test it


------------------------------------------------------------------------
4]4's Profile: http://forums.slimdevices.com/member.php?userid=71351
View this thread: http://forums.slimdevices.com/showthread.php?t=113661

_______________________________________________
unix mailing list
unix@lists.slimdevices.com
http://lists.slimdevices.com/mailman/listinfo/unix

Reply via email to