[PD] restart bash script

Peter P. peterparker at fastmail.com
Thu May 10 10:45:36 CEST 2018


* michael strohmann <itsnotfair9 at gmail.com> [2018-05-10 09:09]:
> Hi !
> thanks to Jack and Roman this bash script successfully restarts pd:
> #!/bin/bash
> sudo puredata /path/to/patch.pd & 
> PID1=$!
> while true 
> do
> 	if [ ! -d /proc/$PID1 ]
> 	then
> 	sudo puredata  /path/to/patch.pd &
> 	PID1=$!
> 	fi
> sleep 1
> done
> what i don’t yet get is: what happens if pd is still running but hanging in limbo, frozen in the watchdog loop.
> i mean sometimes pd is still running but does not output sound or react to input…
> is there a solution to kill and restart pd in such a case?

Please excuse the obvious answer, but it would be best to first find out
why Pd would hang and solve the problem at its source. Other
hacks/workaround cound include:
-Depending on what your installation is about it could be possible to
restart Pd or your computer every day. A simple timerswitch would
-Have Pd send a (heartbeat) message to another program via FUDI or OSC.
When this message is not received it could indicate that Pd hangs and
that other program could kill PID1 and restart.

By the way: Is there a reason you run Pd as root?

cheers, P

More information about the Pd-list mailing list