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

Ben Koenig techkoenig at gmail.com
Tue Jan 28 14:57:08 UTC 2020


On Mon, Jan 27, 2020 at 11:30 PM John Jason Jordan <johnxj at gmx.com> wrote:

> On Mon, 27 Jan 2020 22:40:09 -0800
> Ben Koenig <techkoenig at gmail.com> dijo:
>
> >> Oh wait, it won't. I had been running the script over and over today
> >> to set up the message window, but I had been running it as me (jjj).
> >> Just now I tried it with sudo and the message failed:
> >>
> >> No protocol specified
> >> Unable to init server: Could not connect: Connection refused
> >> gxmessage: unable to initialize GTK
>
> >Use the $DISPLAY variable to launch on a target X server. Since you on
> >a desktop system you probably only have X running once, so try
> >something like this
> >DISPLAY=:0 gxmessage <args go here>
> >
> >you can echo $DISPLAY to find out what display is currently running.
> >Setting the env variable before any graphical command can be used to
> >specify which x server/screen you want it to be displayed on. cron
> >jobs run outside of X, so $DISPLAY is usually unset.
>
> Thanks, but it still isn't working. I started by setting DISPLAY=:0 as
> in your example, but when it didn't work I did:
>
> echo $DISPLAY
> :0.0
>
> And then I changed it to DISPLAY=:0.0, but it still doesn't work.
>
> It sounds like you're onto the solution, but it's too late and I can't
> think any more. I'll hit it again in the morning.
>

If the $DISPLAY variable doesn't work, then you can probably use the
-display option. I just tried this on my system, and as it turns out you
also need to set your Xauthority as well

$ XAUTHORITY=/home/<username>/.Xauthority gxmessage -display :0 "Hello,
world!"

Setting display on it's own isn't enough.


_______________________________________________
> PLUG mailing list
> PLUG at pdxlinux.org
> http://lists.pdxlinux.org/mailman/listinfo/plug
>



More information about the PLUG mailing list