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


Groups > linux.debian.user > #229885 > unrolled thread

MY crontab ain't me!

Started byGene Heskett <gheskett@shentel.net>
First post2020-12-21 14:50 +0100
Last post2020-12-21 19:00 +0100
Articles 10 — 5 participants

Back to article view | Back to linux.debian.user


Contents

  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

#229885 — MY crontab ain't me!

FromGene Heskett <gheskett@shentel.net>
Date2020-12-21 14:50 +0100
SubjectMY crontab ain't me!
Message-ID<BotJv-86j-5@gated-at.bofh.it>
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.

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

Thanks for any enlightenment.

Cheers, Gene Heskett
-- 
"There are four boxes to be used in defense of liberty:
 soap, ballot, jury, and ammo. Please use in that order."
-Ed Howdershelt (Author)
If we desire respect for the law, we must first make the law respectable.
 - Louis D. Brandeis
Genes Web page <http://geneslinuxbox.net:6309/gene>

[toc] | [next] | [standalone]


#229886

FromGreg Wooledge <wooledg@eeg.ccf.org>
Date2020-12-21 15:10 +0100
Message-ID<Bou2R-8sh-1@gated-at.bofh.it>
In reply to#229885
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!

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.

[toc] | [prev] | [next] | [standalone]


#229887

From<tomas@tuxteam.de>
Date2020-12-21 15:10 +0100
Message-ID<Bou2S-8sh-9@gated-at.bofh.it>
In reply to#229885

[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).

[toc] | [prev] | [next] | [standalone]


#229888

Fromtomas@tuxteam.de
Date2020-12-21 15:20 +0100
Message-ID<Boucx-8vg-3@gated-at.bofh.it>
In reply to#229887

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

On Mon, Dec 21, 2020 at 03:09:32PM +0100, tomas@tuxteam.de wrote:

[environment variables and things]

Wel, the DCOP docs are here [1] (Ah, Doxygen docs. Is there a
term for "illiterate programming"?). Convincing my search engine
to search that site for "environment variable" yields some hits
(e.g. [2]) -- it seems a bit more involved that "just" setting
an env variable (reading a file in your home directory and
things).

I feel dirty now.

Cheers

[1] https://api.kde.org/3.5-api/kdelibs-apidocs/dcop/html/index.html
[2] https://api.kde.org/3.5-api/kdelibs-apidocs/dcop/html/index.html#iuc

 - t

[toc] | [prev] | [next] | [standalone]


#229890

FromGene Heskett <gheskett@shentel.net>
Date2020-12-21 16:00 +0100
Message-ID<BouPg-gD-3@gated-at.bofh.it>
In reply to#229888
On Monday 21 December 2020 09:18:45 tomas@tuxteam.de wrote:

> On Mon, Dec 21, 2020 at 03:09:32PM +0100, tomas@tuxteam.de wrote:
>
> [environment variables and things]
>
> Wel, the DCOP docs are here [1] (Ah, Doxygen docs. Is there a
> term for "illiterate programming"?). Convincing my search engine
> to search that site for "environment variable" yields some hits
> (e.g. [2]) -- it seems a bit more involved that "just" setting
> an env variable (reading a file in your home directory and
> things).
>
> I feel dirty now.

So do I, even that bow legged name generates ill feelings. Me and my 
printer both need a shower. But its better than nothing, and may 
accidentally have what it takes to make it work.

Thanks Tomas
>
> Cheers
>
> [1] https://api.kde.org/3.5-api/kdelibs-apidocs/dcop/html/index.html
> [2]
> https://api.kde.org/3.5-api/kdelibs-apidocs/dcop/html/index.html#iuc
>
>  - t


Cheers, Gene Heskett
-- 
"There are four boxes to be used in defense of liberty:
 soap, ballot, jury, and ammo. Please use in that order."
-Ed Howdershelt (Author)
If we desire respect for the law, we must first make the law respectable.
 - Louis D. Brandeis
Genes Web page <http://geneslinuxbox.net:6309/gene>

[toc] | [prev] | [next] | [standalone]


#229896

From<tomas@tuxteam.de>
Date2020-12-21 17:00 +0100
Message-ID<BovLk-Pn-5@gated-at.bofh.it>
In reply to#229890

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

On Mon, Dec 21, 2020 at 09:50:37AM -0500, Gene Heskett wrote:
> On Monday 21 December 2020 09:18:45 tomas@tuxteam.de wrote:

[...]

> > I feel dirty now.
> 
> So do I, even that bow legged name generates ill feelings. Me and my 
> printer both need a shower. But its better than nothing, and may 
> accidentally have what it takes to make it work.

Hoping you nail it. And careful when showering that printer.
If it's a laser, then there's some HV around inside ;-)

Cheers, good luck
 - t

[toc] | [prev] | [next] | [standalone]


#229900

FromGene Heskett <gheskett@shentel.net>
Date2020-12-21 18:30 +0100
Message-ID<Boxaq-1ML-13@gated-at.bofh.it>
In reply to#229896
On Monday 21 December 2020 10:53:23 tomas@tuxteam.de wrote:

> On Mon, Dec 21, 2020 at 09:50:37AM -0500, Gene Heskett wrote:
> > On Monday 21 December 2020 09:18:45 tomas@tuxteam.de wrote:
>
> [...]
>
> > > I feel dirty now.
> >
> > So do I, even that bow legged name generates ill feelings. Me and my
> > printer both need a shower. But its better than nothing, and may
> > accidentally have what it takes to make it work.
>
> Hoping you nail it. And careful when showering that printer.
> If it's a laser, then there's some HV around inside ;-)

This ones an ink squirter, but I have a much better color laser that 
despite my being a CET, Brother will not sell me a new corona wire HV 
generator board for. One of these days I'll diss it and see if I can fix 
it, likely a bad, high ESR capacitor.

Its not like this is my first electronics rodeo, by about 75 years. And I 
do know what to do with high voltages, one tv transmitter I maintained 
for 8 years could have crowbarred all of Wayne County Nebraska if a 
filter capacitor shorted. Over 300KWH was its normal singing voice.  Add 
at least another 0 to that when shorted by a klystron full of water 
because a $75 circuit breaker failed and single phased a 15 hp water 
pump.

Because of the cost of that klystron, the guv had to call in a quorum of 
the legislature to write the check for a new one. About $150,000 at the 
time for everything. That also got circuitry installed to stop that from 
ever happening again. Expen$ive lesson but that fix was then installed 
at all the NETV sites that were UHF and subject to that failure mode. 2 
others IIRC.

> Cheers, good luck
>  - t


Cheers, Gene Heskett
-- 
"There are four boxes to be used in defense of liberty:
 soap, ballot, jury, and ammo. Please use in that order."
-Ed Howdershelt (Author)
If we desire respect for the law, we must first make the law respectable.
 - Louis D. Brandeis
Genes Web page <http://geneslinuxbox.net:6309/gene>

[toc] | [prev] | [next] | [standalone]


#229904

From<tomas@tuxteam.de>
Date2020-12-21 19:00 +0100
Message-ID<BoxDr-1WL-3@gated-at.bofh.it>
In reply to#229900

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

On Mon, Dec 21, 2020 at 12:26:28PM -0500, Gene Heskett wrote:
> On Monday 21 December 2020 10:53:23 tomas@tuxteam.de wrote:
> 
> > On Mon, Dec 21, 2020 at 09:50:37AM -0500, Gene Heskett wrote:
> > > On Monday 21 December 2020 09:18:45 tomas@tuxteam.de wrote:
> >
> > [...]
> >
> > > > I feel dirty now.
> > >
> > > So do I, even that bow legged name generates ill feelings. Me and my
> > > printer both need a shower. But its better than nothing, and may
> > > accidentally have what it takes to make it work.
> >
> > Hoping you nail it. And careful when showering that printer.
> > If it's a laser, then there's some HV around inside ;-)
> 
> This ones an ink squirter, but I have a much better color laser that 
> despite my being a CET, Brother will not sell me a new corona wire HV 
> generator board for. One of these days I'll diss it and see if I can fix 
> it, likely a bad, high ESR capacitor.

[...]

I know you have been around high voltages and high frequencies, possibly
higher than many of us, so my comment was a bit tongue-in-cheek ;-P

Cheers
 - t

[toc] | [prev] | [next] | [standalone]


#229897

FromNicholas Geovanis <nickgeovanis@gmail.com>
Date2020-12-21 17:10 +0100
Message-ID<BovV1-17Y-11@gated-at.bofh.it>
In reply to#229888

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

On Mon, Dec 21, 2020, 8:19 AM <tomas@tuxteam.de> wrote:

> On Mon, Dec 21, 2020 at 03:09:32PM +0100, tomas@tuxteam.de wrote:
>
> [environment variables and things]
>
> Wel, the DCOP docs are here [1] (Ah, Doxygen docs. Is there a
> term for "illiterate programming"?).
> ....
>

The Jesus-freak spirit of Knuth rebukes you 😂
It's a tangled web he weaves, only the lonely survive. But any committed
Christian with a pipe organ that size in his own home might be salvageable.
🙄

>  - t
>

[toc] | [prev] | [next] | [standalone]


#229903

Fromtomas@tuxteam.de
Date2020-12-21 19:00 +0100
Message-ID<BoxDr-1WL-7@gated-at.bofh.it>
In reply to#229897

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

On Mon, Dec 21, 2020 at 10:04:48AM -0600, Nicholas Geovanis wrote:
> On Mon, Dec 21, 2020, 8:19 AM <tomas@tuxteam.de> wrote:
> 
> > On Mon, Dec 21, 2020 at 03:09:32PM +0100, tomas@tuxteam.de wrote:
> >
> > [environment variables and things]
> >
> > Wel, the DCOP docs are here [1] (Ah, Doxygen docs. Is there a
> > term for "illiterate programming"?).
> > ....
> >
> 
> The Jesus-freak spirit of Knuth rebukes you 😂
> It's a tangled web he weaves, only the lonely survive. But any committed
> Christian with a pipe organ that size in his own home might be salvageable.
> 🙄

Yeah. The term came to me thinking of DEK. Somehow the process is the
inverse of literate programming: you write the code, and the docs
follow -> illiterate programming.

To be fair, the DCOP doc isn't /that/ bad, but having suffered Doxygen
for many a Java project "this function has that-and-that name and takes
this-and-that types of args" hey, the source knows that already! I'm
a bit wary of that. Thus my snark.

Cheers
 - t

[toc] | [prev] | [standalone]


Back to top | Article view | linux.debian.user


csiph-web