Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.debian.user > #229887

Re: MY crontab ain't me!

From <tomas@tuxteam.de>
Newsgroups linux.debian.user
Subject Re: MY crontab ain't me!
Date 2020-12-21 15:10 +0100
Message-ID <Bou2S-8sh-9@gated-at.bofh.it> (permalink)
References <BotJv-86j-5@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


[Multipart message — attachments visible in raw view] - view raw

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 <root@coyote.coyote.den>
>  To: gene@coyote.coyote.den
>  
> ERROR: Couldn't attach to DCOP server!
> 
> I have other scripts to aid my incoming email that run as me, and use 
> dcop to get their job done w/o a problem.
> 
> But put the exact same command in MY crontab and its rejected.

This is, as I gather, your "personal" crontab. So the cron job
is running under you UID. Good.

> 2 questions, why?, and why is this email from root?

As to your first question, the most probable cause is that your
cron job hasn't the environment needed to get in touch with
the DCOP server.

One typical mechanism (note that I know zilch about DCOP, and,
to be honest, would like to avoid dirtying my soul with all
the saddening details ;-) is that DCOP listens on some socket.
Typically (again), there is an environment variable (or several)
in your session's environment containing the coordinates of
said socket (or - whatever).

What you can do is (besides reading DCOP's documentation, if
any) issue

  set | grep DCOP

(or some variation on it) to find about likely environment
variable candidates. This, of course, from a shell running
under your DE's environment (a terminal window started from
your GUI will do).

Then set those environment variables in your cron job. The
crontab format itself (cf. man 5 crontab) has provisions to
set environment -- alternatively you can call from there a
script setting the necessary environment (perhaps because
you don't want all your cron entries to have the same
environment).

Possibly DCOP has some utility to "join" a user "session",
dunno.

But this all is a hunch. Some tinkering needed.

I test out such things by letting my cron commands append
debugging stuff to some temporary file. By default, cron
has no logfiles and mails you its complaints, as you
already found out.

As to your second question -- cron runs as root and changes
to the relevant UID when needed (it couldn't were it not
root).

Back to linux.debian.user | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

MY crontab ain't me! Gene Heskett <gheskett@shentel.net> - 2020-12-21 14:50 +0100
  Re: MY crontab ain't me! Greg Wooledge <wooledg@eeg.ccf.org> - 2020-12-21 15:10 +0100
  Re: MY crontab ain't me! <tomas@tuxteam.de> - 2020-12-21 15:10 +0100
    Re: MY crontab ain't me! tomas@tuxteam.de - 2020-12-21 15:20 +0100
      Re: MY crontab ain't me! Gene Heskett <gheskett@shentel.net> - 2020-12-21 16:00 +0100
        Re: MY crontab ain't me! <tomas@tuxteam.de> - 2020-12-21 17:00 +0100
          Re: MY crontab ain't me! Gene Heskett <gheskett@shentel.net> - 2020-12-21 18:30 +0100
            Re: MY crontab ain't me! <tomas@tuxteam.de> - 2020-12-21 19:00 +0100
      Re: MY crontab ain't me! Nicholas Geovanis <nickgeovanis@gmail.com> - 2020-12-21 17:10 +0100
        Re: MY crontab ain't me! tomas@tuxteam.de - 2020-12-21 19:00 +0100

csiph-web