Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8167873
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T20:20:23+00:00 2026-06-06T20:20:23+00:00

I am trying to start a X-Programm (e.g. gedit or Firefox) with crontab. I

  • 0

I am trying to start a X-Programm (e.g. gedit or Firefox) with crontab.
I have searched quite a while, and the forums are full of help, unfortunately nothing was usefull for me.

What I am trying is, to start a X-Programm by Crontab.
For testing Purposes I have done the following:

Entry in my “/etc/crontab” (my User-Account is mrs, I am logged on):

* * * * * mrs /bin/bash /tmp/test.sh

cat /tmp/test.sh:

#!/bin/bash
DISPLAY=":0.0"
gedit 1> /tmp/out 2>/tmp/err

cat /tmp/err:

No protocol specified
(gedit:3456): Gtk-WARNING **: cannot open display: :0.0

/tmp/out is empty!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-06T20:20:25+00:00Added an answer on June 6, 2026 at 8:20 pm

    I have found the solution!
    The Problem is, that I did not had an XAUTHORITY.
    So I had to get a valid XAUTHENTICATION.
    I have tried a lot with xhost and xauth, but it did not help. Now I found another simple way wich works with gnome/gdm3, if you have access to the root Crontab:

    export DISPLAY=":0.0"
    [ -z $USER ] && USER=$( who | awk '{ print $1 }' | sort | uniq >/tmp/test )
    for I in /var/run/gdm3/*; do
        AUTHUSER="`echo $I | awk -F '-' '{ print $3 }'`"
        for J in $USER; do
            [ "${AUTHUSER}" = "${J}" ] || continue
            USER="$J"
            export XAUTHORITY="${I}/database" && break
        done
    done
    sudo -u ${USER} /Pfad/zum/xProgramm
    

    Die Variable $USER kann man vorher belegen, andernfalls wird sie mit mindestens einem bereits eingeloggten User beschrieben. Vorraussetzung ist allerdings, dass ein User am System auch angemeldet ist.

    Ich habe dies getestet, und es klappt problemlos!

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to start perfmon and another program that have GUI's through a python
I am trying to start a process and capture the output, have come a
I'm trying to start firefox form a Java program, so far i know how
i am trying to start the Program D from the terminal, command in terminal
I'm trying to start Microsoft word using QProcess as following: QString program = WINWORD.EXE;
I'm trying to compile this simple program to start learning how to use timers:
I'm trying to write a program that can stop and start services using SilverLight
When trying to start my JUnit-Test out of Eclipse, I get a ClassNotFoundException. When
I'm trying to start a Vagrant instance and getting the following message: Vagrant cannot
I am trying to start the main activity from inside a BroadcastReceiver. I dont

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.