[PD] Cannot run pd patch from crontab at startup on raspi
reduzent at gmail.com
Fri Jun 28 09:04:46 CEST 2019
On Fri, 2019-06-28 at 12:29 +0800, Chris McCormick wrote:
> On 28/6/19 4:38 am, Csaba Láng wrote:
> > @reboot puredata -gui -open /path-to-patch
> > Any clue what is wrong? Tried everything even put into script but
> > no luck!
> * Is this installed in the crontab of the 'pi' user?
> * Have you tried that exact command on the command line - e.g.
> and pasting and ensuring it works?
> * On my system at least the binary is called 'pd' rather than
> 'puredata' - have you verified this is the correct binary?
> * By default cron is often missing important environment variables
> such as PATH. Try specifying the full path to your puredata binary.
To complement Chris' list:
* Re: environment variables: Scripts or commands might not be aware
that they are running in a graphical environment. When starting a GUI
programm from terminal logged through ssh, specifying the DISPLAY helps
(maybe you need that for cron, too):
DISPLAY=:0 /usr/bin/puredata -gui -open /abs/path/to/your/patch
* However, this might still not be sufficient, since the the user's
crontab might be executed _before_ the graphical (a.k.a "desktop")
environment is ready. You could prepend your command with 'sleep 20; '
but that might not be reliable and is ugly
* My final suggestion is to not use cron at all. Cron is good for
background scripts and daemon, but things get hairy with graphical
applications (see above why). Most "desktop" environments provide a way
to put programs to "autostart" so that those programs are started when
the graphical user session is started. This avoids any race conditions
(e.g. cron runs too early) and confusion about which user runs the
session and what DISPLAY is used.
I believe the graphical environment of Raspbian is derived from LXDE.
So, maybe this helps:
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 488 bytes
Desc: This is a digitally signed message part
More information about the Pd-list