Find the answer to your Linux question:
Results 1 to 2 of 2
I am trying to get gnome-terminal to open from a crontab. Cron's environment is stopping it. I have tried this: Code: * * * * * . /home/steve/.bashrc ; /home/steve/script.sh ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Oct 2011
    Posts
    1

    Cron Environment won't run script


    I am trying to get gnome-terminal to open from a crontab. Cron's environment is stopping it. I have tried this:

    Code:
    * * * * * . /home/steve/.bashrc ; /home/steve/script.sh
    and I have tried this:

    Code:
    * * * * * . /home/steve/.profile ; /usr/bin/gnome-terminal
    Neither will work. How do I fix this?

  2. #2
    Trusted Penguin
    Join Date
    May 2011
    Posts
    4,353
    may I ask why on earth you are trying to do this? Perhaps there is another way to achieve what you are trying to do, is why I ask.

    It probably needs the DISPLAY env var set, but I'm just guessing. Redirect the output of your script to a log to see the errors.

    Code:
    * * * * * /home/steve/script.sh > /tmp/stevescript.log 2>&1
    You can also check /var/log/messages and /var/log/cron to see if they say anything.

    To try using the DISPLAY var, put this at the top of steve's script:
    Code:
    export DISPLAY=:0.0

Posting Permissions

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