`at` Not Working

johnywhy

New Member
hi

This command isn't getting executed, but no errors. What am i doing wrong? I'm hitting CTRL-D after entering the command. On arch:

Code:
$ at now + 1 minutes
warning: commands will be executed using /bin/sh
at Wed Nov 13 09:48:00 2019
at> xset s activate
at> <EOT>
job 5 at Wed Nov 13 09:48:00 2019
thx!
 


JulienCC

Active Member
Hello,

Probably xset having difficulties finding the actual display (since probably run from an other user)
Bash:
xset -display :0 s activate
 

johnywhy

New Member
Thx, Your fix works, but i don't understand why.
Which other user?

i'm seeing:
Code:
$ at now + 1 minutes
warning: commands will be executed using /bin/sh
So, root? Why? How can a non-root user execute a root command like this?

thx
 

JulienCC

Active Member
So, root? Why? How can a non-root user execute a root command like this?
In fact it's not directly related to the user. X commands use the DISPLAY env variable to figure out which display is being used. When switching user the environement is reset, so no DISPLAY in env. This is why it's common to have people struggling to use X commands while being root.

But in this case the service behind "at" is probably not even aware of X being started, the DISPLAY env variable was probably not even set when the service was started.
 

JulienCC

Active Member
Where are we switching user?
As I said in this case you are not switching the user. The DISPLAY env is simply not set.
After checking "at" man page :

These variables are excluded from this processing and are never set by at when the commands are run :
TERM, DISPLAY, SHELLOPTS, _, PPID, BASH_VERSINFO, EUID, UID, GROUPS

Which means that "at" command actually saves the env of the invocation. But it removes the DISPLAY variable.
 

Members online


Top