Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

$DISPLAY not set. #263

Closed
rominail opened this issue Aug 24, 2023 · 5 comments
Closed

$DISPLAY not set. #263

rominail opened this issue Aug 24, 2023 · 5 comments

Comments

@rominail
Copy link

General information:

  • OS name: Ubuntu
  • OS version: 23.04
  • OS architecture: 64 bits
  • Resolutions:
    • Monitor 1: 800x600
    • Monitor 2: 1920x1080
  • Python version: 3.11.4
  • MSS version: 9.0.1

For GNU/Linux users:

  • Display server protocol and version, if known: X11
  • Desktop Environment: Gnome

Through the usage of pombo, when using it from CLI there is no problem, when executed from the cronjob I get the message "$DISPLAY not set."
I don't know if I should change any conf for the crontask or if it's something with the library as it use to work (but I don't know when it stopped)

@BoboTiG
Copy link
Owner

BoboTiG commented Aug 26, 2023

When you execute anything from a cronjob, you have to define DISPLAY yourself.

  1. Get the current value in a terminal:
    $ echo $DISPLAY
    :0
  2. In your cronjob:
    * * * * * DISPLAY=:0 COMMAND
    Adapt the frequency, what is important is to prefix the command with DISPLAY=:0 .

@rominail
Copy link
Author

Thank you!

@rominail
Copy link
Author

For information for other person who might experience the same issue (and might be nice to put it in the linux doc)
I also added XAUTHORITY=/run/user/1000/gdm/Xauthority in my root crontab

@WanMMao
Copy link

WanMMao commented Sep 4, 2023

image May I ask if using crontab still results in $DISPLAY not set? Is there something wrong with me?

@rominail
Copy link
Author

I don't know if there is something wrong with your code what I did is :

# m h  dom mon dow   command
DISPLAY=:0
XAUTHORITY=/run/user/1000/gdm/Xauthority
*/15 * * * * /usr/local/bin/pombo 2>/dev/null

Also, if your issue is not related to the repo, open an issue on a dedicated website (eg: stackexchange)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants