SOLVED Re: how to start a kde application via shell script

Antonio Augusto (Mancha) mkhaos7 at
Fri May 22 14:18:01 BST 2009

On Fri, May 22, 2009 at 09:59, Sascha Güthling <guethling at> wrote:
> I take the SOLVED back. I would remove it from the subject but that
> would mess up the thread.
> I was too quick with my conclusion that it would work. It only works
> when I call it from tty1 but still not with cron.
> On Fri, May 22, 2009 at 8:47 AM, Jonas Norlander <jonorland at> wrote:
>> On Fri, May 22, 2009 at 2:29 PM, Sascha Güthling
>> <guethling at> wrote:
>>> On Thu, May 21, 2009 at 8:59 PM, Bruce Marshall <bmarsh at> wrote:
>>>> On Thursday 21 May 2009, Antonio Augusto (Mancha) wrote:
>>>>> One of the reasons that it doesn't work from cron is that the cron
>>>>> process doesn't have an X session associated with it.
>>>>> You can try puting the following before calling the kde application:
>>>>> export DISPLAY=0:0
>>>> I recently got a similar command to work by using the display statement right
>>>> in the cron line:
>>>> */10 * * * * DISPLAY=:0.0 /usr/local/bin/keepxfd2
>>>> The above runs a script I wrote.
>>> I tried both, I put 'export DISPLAY=0:0' and 'export DISPLAY=:0.0' in
>>> my script before calling the KDE app, both didn't work. I got errors
>>> saying "/usr/bin/bmix bad variable"
>>> Changing my the crontab didn't help either.
>>> But that told me to try piping the application start through export
>>> DISPLAY=0:0 and that worked.
>>> My script now looks as follows:
>>> #!/bin/sh
>>> /usr/bin/kmix | export DISPLAY=0:0
>>> It works great.
>> I don't understand why that work. For the record can someone explain?
>> / Jonas
> This works (at least if you call the script from tty1) because the
> output of /usr/bin/kmix is send to and used as input (the pipe symbol
> '|')  for export DISPLAY=0:0. That means that everything that happens
> while starting kmix will happen on display 0:0 (your KDE desktop). In
> this case kmix is started.
> Unfortunately when executed by cron it still doesn't work.
> Does anyone have another idea?
> Thanks
> Sascha

Sascha, coud you try the following in your script:

DISPLAY=:0.0 /usr/bin/kate

Also, you might night to run "xhost +" on your KDE session before
running the above script, so the cron process can access it.


More information about the kubuntu-users mailing list