Page 2 of 3 FirstFirst 123 LastLast
Results 11 to 20 of 21

Thread: HowTo make cron run GUI applications

  1. #11
    Join Date
    Sep 2005
    Beans
    85

    Re: HowTo make cron run GUI applications

    Code:
    $ ls /tmp/.X11-unix/
    X0
    You are on to something with the console/terminal. If I type:

    Code:
    $ export DISPLAY=:0 && zenity --notification --text "This is a test."
    in Gnome-Terminal it works. However, if I log into tty1 and try the same command I get the error:

    Xlib: connection to ":0.0" refused by server
    Xlib: No protocol specified

    Syntax error

  2. #12
    Join Date
    Apr 2005
    Location
    Sintra, Portugal
    Beans
    835

    Re: HowTo make cron run GUI applications

    Quote Originally Posted by kashms
    Code:
    $ ls /tmp/.X11-unix/
    X0
    You are on to something with the console/terminal. If I type:

    Code:
    $ export DISPLAY=:0 && zenity --notification --text "This is a test."
    in Gnome-Terminal it works. However, if I log into tty1 and try the same command I get the error:
    Are you logged in with your normal user (the one running X) on the console? Are you running crontab as normal user or system wide?

  3. #13
    Join Date
    Sep 2005
    Beans
    85

    Wink Re: HowTo make cron run GUI applications

    Quote Originally Posted by henriquemaia
    Are you logged in with your normal user (the one running X) on the console? Are you running crontab as normal user or system wide?
    I log in as normal user both in X and in console. I think the root account has not even been activated.

    If in the console I do "sudo -s" and then try the same command I get the following error:

    Xlib: connection to ":0.0" refused by server
    Xlib: Invalid MIT-MAGIC-COOKIE-1 key
    Syntax error
    Apparently my cookies are no good

  4. #14
    Join Date
    Apr 2005
    Location
    Sintra, Portugal
    Beans
    835

    Re: HowTo make cron run GUI applications

    Quote Originally Posted by kashms
    [...]

    Apparently my cookies are no good
    No, that's normal, since Xauthority file is locked for your user only.

    Try this on a terminal:

    Code:
    xhost +
    and then try the
    Code:
    export DISPLAY=:0 && zenity --notification --text "This is a test."
    command from the tty.

  5. #15
    Join Date
    Sep 2005
    Beans
    85

    Re: HowTo make cron run GUI applications

    Code:
    $ xhost +
    access control disabled, clients can connect from any host
    And sure enough the command now works from tty. Thanks!

    How would I use this in the crontab file?
    What are the security implications of using "xhost +"?

  6. #16
    Join Date
    Apr 2005
    Location
    Sintra, Portugal
    Beans
    835

    Re: HowTo make cron run GUI applications

    Quote Originally Posted by kashms
    Code:
    $ xhost +
    access control disabled, clients can connect from any host
    And sure enough the command now works from tty. Thanks!

    How would I use this in the crontab file?
    What are the security implications of using "xhost +"?
    About the security implications, I found this on the internet:

    «The xhost command opens a huge security hole because it gives to any user of the remote computer rights to control the behavior and to monitor the display, the keyboard, and the mouse of the local computer. The only secure setting of xhost is "xhost -" which denies any access, except for the local user.»

    The thing is that with that you have found that you have an issue with the way your xserver is dealing with the hosts.

    try resetting the xhost to

    Code:
    xhost -
    and then use the command again from the tty, to see if you get the same previous error.

    If yes, do:

    Code:
    xhost local:name_of_your_user
    and then run the command (from the tty).

    Let's see if this helps.

  7. #17
    Join Date
    Sep 2005
    Beans
    85

    Re: HowTo make cron run GUI applications

    Code:
    $ xhost -
    access control enabled, only authorized clients can connect
    From tty I then get the same error as before.

    Code:
    $ xhost local:my_user
    non-network local connections being added to access control list
    The command works again from tty. Excellent!

  8. #18
    Join Date
    Apr 2005
    Location
    Sintra, Portugal
    Beans
    835

    Re: HowTo make cron run GUI applications

    Quote Originally Posted by kashms
    Code:
    $ xhost -
    access control enabled, only authorized clients can connect
    From tty I then get the same error as before.

    Code:
    $ xhost local:my_user
    non-network local connections being added to access control list
    The command works again from tty. Excellent!
    If that gets things right, put that

    Code:
    xhost local:your_user
    on the .bashrc, so it will be run everytime you login. Now you can have your cron thing working everytime.

  9. #19
    Join Date
    Sep 2005
    Beans
    85

    Re: HowTo make cron run GUI applications

    That worked! Thanks for your help.

  10. #20
    Join Date
    Apr 2005
    Location
    Sintra, Portugal
    Beans
    835

    Re: HowTo make cron run GUI applications

    Quote Originally Posted by kashms
    That worked! Thanks for your help.
    You're welcome. I'm glad to help.

Page 2 of 3 FirstFirst 123 LastLast

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •