[PD] watchdog

Peter P. peterparker at fastmail.com
Thu May 3 11:02:37 CEST 2018

* Roman Haefeli <reduzent at gmail.com> [2018-05-03 09:42]:
> On Thu, 2018-05-03 at 06:29 +0200, michael strohmann wrote:
> > Hello, 
> > i wonder if it is possible to setup something on raspberry, so that
> > the puredata-watchdog will restart pd-0.48.0 automatically?
> > where could i look up the mechanics of this, unfortunatly i am not a
> > unix crack…
> Are you referring to the pd-watchdog binary, that comes with puredata-
> core? Is your Raspberry Pi running Raspbian?
> From what I understand, the purpose of the pd-watchdog is to pause Pd
> in regular intervals when running in real-time mode. I think this is
> measure to prevent Pd from locking up the system. Assume you
> accidentally trigger an [until] without a stopping mechanism, thanks to
>  pd-watchdog you're still able to move the mouse and quit Pd.
> Is your goal to make sure that Pd is running at any time, so that it is
> started again as soon as it stops?  Maybe you can achieve something
> like this wit a shell script. I haven't tested this, but it might give
> you an idea how to make it work:
> ---
> #!/bin/sh
> while true
> do 
>   # We start pd and send detach it from the terminal ('&')
>   /usr/bin/pd -open yourpatch & 
>   # we catch pd's process id
>   pdpid=$!
>   # now let's wait for the process to terminate
>   wait $pdpid
>   # once pd terminates, we start another iteration
>   # of our while-loop
> done
> ---

I like 
	until !!; do :; done
which restarts the last command from bash_history in case it exits
without a clean 0 exit status. Useful for all sorts of things. I guess
it can also be written as
	until pd myCrashingPatch.pd; do; :; done

More information about the Pd-list mailing list