Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I set the following cron in my local machine.

* * * * * /bin/bash -c /home/JSX/Stuff/J/login-check/open-console.sh

The content of open-console.sh is the following:-

#! /bin/sh
gnome-terminal --full-screen --hide-menubar -e /home/JSX/Stuff/J/login-check/handle-user.sh

It is supposed to open another sh script in terminal. But nothing is happening. Is there anything else I need to do? Like restarting a service or something for the cron job to start running?

*** Absolute paths given in the files are correct. When I entered the command /bin/bash -c /home/JSX/Stuff/J/login-check/open-console.sh directly in the terminal, it worked.

share|improve this question
add comment

1 Answer

up vote 4 down vote accepted

Cron has no idea where the current display is (from its point of view, there can be many running), so it cannot -- easily -- start a graphical terminal. If you are the only user of the machine with only one X session, you can try to define your DISPLAY variable

export DISPLAY=:0.0

in open-console.sh, but I'm not sure whether it will work.

The main purpose of cron is to start non-interactive services that run in the background at specified points of time. Other tasks should be handled with dbus and ConsoleKit, but this is a bit more complicated, see this question.

share|improve this answer
    
That was it :) Thank you for the solution and insight. –  Sparky Oct 19 '12 at 7:02
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.