4

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.

1 Answer 1

10

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.

1
  • 1
    That was it :) Thank you for the solution and insight.
    – Sparky
    Oct 19, 2012 at 7:02

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .