'4 wrote: 
> 4;1008769']You are correct. In DietPi there is a different method of
> getting the status message.
> 
> > 
Code:
--------------------
  >   >  dietpi-services status squeezelite
--------------------
> > 
> 
> which outputs:
> 
> > 
Code:
--------------------
  >   >  DietPi-Services
  > 
─────────────────────────────────────────────────────
  > Mode: status squeezelite
  > 
  > [  OK  ] DietPi-Services | squeezelite          active (running) since Mon 
2021-02-08 21:47:43 GMT; 12h ago
  > 
--------------------
> > 
> 
> or in case the service isn't active:
> 
> > 
Code:
--------------------
  >   >  DietPi-Services
  > 
─────────────────────────────────────────────────────
  > Mode: status squeezelite
  > 
  > [ INFO ] DietPi-Services | squeezelite          inactive (dead)
  > 
--------------------
> > 
> 
> To start, stop or restart we should use:
> 
> > 
Code:
--------------------
  >   > dietpi-services <stop/start/restart> squeezelite
--------------------
> > 
> 
> I will update the script with these commands.

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.


------------------------------------------------------------------------
chill's Profile: http://forums.slimdevices.com/member.php?userid=10839
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