[PLUG] SOLVED Make cron send an e-mail upon completion

Tomas Kuchta tomas.kuchta.lists at gmail.com
Wed Jan 29 01:07:43 UTC 2020


Ben,

I think that the issue at hand is that you are trying it from the desktop -
then it works.

Does it work for you from outside the desktop - say cron or ssh shell from
another computer?

Tomas

On Tue, Jan 28, 2020, 19:26 Ben Koenig <techkoenig at gmail.com> wrote:

> The whole point of setting the DISPLAY and XAUTHORITY variables to make it
> so you CAN open the window as root. Trying to use the .Xauthority for the
> root user won't work unless the X server was started by root. So you
> specify the .Xauthority for jjj, and as long as X is actually running then
> it works fine. Of course if something closes X in the middle of the night
> then yeah it's going to fail.
>
> You can try this on literally any distro, no guesswork is required. start
> your desktop, then hop out to a different VT (ctrl+calt+f2), log in, sudo
> su to root and then execute the following:
> DISPLAY=:0 XAUTHORITY=/home/<username>/.Xauthority xterm
>
> If this fails then X is either not running as the chosen user, not running
> at all, or has been configured using non-standard settings. Another
> possibility is that cron is not actually running commands as root.
>
> Am I wrong to assume that cronjobs are always run as root? I don't actually
> know since I don't mess with cron beyond the most basic options. Most of my
> cron tasks were made by point-and-click in FreeNAS.
>
> On Tue, Jan 28, 2020 at 3:57 PM Tomas Kuchta <tomas.kuchta.lists at gmail.com
> >
> wrote:
>
> > The topic to research would be X11 authorization and MIT cookies.
> >
> > It will require commands to run on both sides of the command line: a)
> your
> > desktop will need to authorize the connection (every time you start
> > desktop) b) Cron using that authorization to display the window.
> >
> > The easiest to work around is probably for Cron to write a message to a
> > file and some forever running desktop script checking that file and open
> > the dialog.
> >
> > Another alternative would be to use system messaging infrastructure in
> > Gnome/KDE.
> >
> > One could also send a message to all user's consoles by ancient command
> > wall.
> >
> > Hope that helps,
> > Tomas
> >
> >
> >
> > On Tue, Jan 28, 2020, 16:58 wes <plug at the-wes.com> wrote:
> >
> > > On Tue, Jan 28, 2020 at 1:21 PM Johnathan Mantey <manteyjg at gmail.com>
> > > wrote:
> > >
> > > > I'm only paying half attention to this.
> > > > You want to run as root, but you are using your own Xauth?
> > > > I'm no X11 wizard, but that doesn't seem like it would work.
> > > > Doesn't /root have a Xauthority file that should be used for root run
> > > > features?
> > > >
> > > >
> > > This only exists if the root user were to have logged in to X at some
> > > point. This is disabled by default.
> > >
> > > Additionally, the goal here is to pop a dialog on the jjj user's X
> > desktop
> > > from a command run by root.
> > >
> > > -wes
> > > _______________________________________________
> > > PLUG mailing list
> > > PLUG at pdxlinux.org
> > > http://lists.pdxlinux.org/mailman/listinfo/plug
> > >
> > _______________________________________________
> > PLUG mailing list
> > PLUG at pdxlinux.org
> > http://lists.pdxlinux.org/mailman/listinfo/plug
> >
> _______________________________________________
> PLUG mailing list
> PLUG at pdxlinux.org
> http://lists.pdxlinux.org/mailman/listinfo/plug
>



More information about the PLUG mailing list