Greg Erskine wrote: 
> I only use "force" option on the command line. I'm wondering if $0 gets
> set correctly if calling from a script.

I think I got to the root of this.  The line:

Code:
--------------------
                sudo ps | grep squeezelite | grep -v grep | awk '{print $1}' | 
xargs kill -9
--------------------

was also killing the init.d script file itself (because its name is
simply 'squeezelite') so it died before it had a chance to issue '$0
start'.

I changed it to the following to also exclude the init.d process, and it
now works when called by udev.

Code:
--------------------
                sudo ps | grep squeezelite | grep -v grep | grep -v init.d | 
awk '{print $1}' | xargs kill -9
  
--------------------


Actually, I'm not sure it matters where it's called from - while it's
name is 'squeezelite', that command should have prevented anything
downstream from running.  Strange.

Modifying the init.d script is not practical for users of this USB DAC
script, so instead I'm trying to incorporate the 'force' approach into
the USB script.  I'd rather not use the full force approach, whereby
first the PID in the PIDFILE is killed and PIDFILE is deleted, and
second ALL squeezelite processes are killed.  The second part of that
approach is clearly aimed at cases where things have got out of sync,
but when this USB script is working properly that shouldn't happen, so
to start with I'm going to implement only the first part.

You'd think it would be straightforward, but at the moment I'm
struggling because the 'sudo kill -9 $PID' isn't working for some
reason.  It works from the command line, but I can't get the script to
do that simple thing successfully.  I guess it's something to do with
permissions/environment, but I don't know of anything beyond 'sudo' to
deal with it.  Any thoughts would be welcomed!!

I suspect this may be at the root of the problem that Bogg identified,
whereby the start-stop-daemon isn't killing the process either.  And
oddly, that's now also the case on my test setup - I had to switch to a
spare RPi 3A+ because my test 3B+ seems to have died :(  

Oh well, at least I now have a test bench for working through this
myself, without having to ask Bogg to jump through hoops.


------------------------------------------------------------------------
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