On Mon, Dec 21, 2020 at 08:42:26AM -0500, Gene Heskett wrote: > I got an email from cron this morning that needs some explaining. > Here is a dcop connand _I_ can execute, no error > /opt/trinity/bin/dcop kmail KMailIface resumeBackgroundJobs > > But I put it in MY crontab and get this email > > Cron <gene@coyote> /opt/trinity/bin/dcop kmail KMailIface > resumeBackgroundJobs > From: Cron Daemon <r...@coyote.coyote.den> > To: g...@coyote.coyote.den > > ERROR: Couldn't attach to DCOP server!
Each process has an execution environment, which is inherited from its parent process. When you log in to a desktop session, either through a Display Manager or by running startx, you get a whole bunch of environment variables created for you, like DISPLAY, and XDG_SESSION_ID, and so on. These variables are set by some primal process in the session, and are propagated down to all of the other things that you run, like window managers, and terminal emulators, and web browsers. A cron job is started by the cron daemon, which runs with basically no environment at all. The cron daemon injects a very small number of variables into your environment for your jobs, like PATH and HOME, but not much more than this. I don't know how "dcop" works, but apparently when you run it from cron, it doesn't have access to the resources it's expecting. You'll need to contact people who know something about dcop, and ask them what it needs. It might be as simple as adding some variables to your crontab, or it might be much harder. Maybe if you get lucky, someone on this list will know about dcop, and you won't have to seek topic experts.