LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 06-19-2008, 06:21 PM   #1
rose_bud4201
Member
 
Registered: Aug 2002
Location: St Louis, MO
Distribution: Xubuntu, RHEL, Solaris 10
Posts: 929

Rep: Reputation: 30
Opening a nautilus via a bash cron script


Ubuntu 8.04, trying to do this in the UI. Basically, I have a script which polls a directory every 10 minutes (via cron) and if it finds something there, I want it to open a nautilus file browser in my face and make me do something with that file.

So.

This works, from the commandline:
sudo nautilus --display=:0.0 /mnt/public/directorywhichexists/

But in my cron script, I get the following in my error log:

No protocol specified
error: cannot open display: :0.0
Run 'nautilus --help' to see a full list of available command line options.

Does anyone know what's different between the two scenarios which might account for the problems?
 
Old 06-19-2008, 06:42 PM   #2
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,393
Blog Entries: 55

Rep: Reputation: 3565Reputation: 3565Reputation: 3565Reputation: 3565Reputation: 3565Reputation: 3565Reputation: 3565Reputation: 3565Reputation: 3565Reputation: 3565Reputation: 3565
Quote:
Originally Posted by rose_bud4201 View Post
error: cannot open display: :0.0
Prolly needs 'export DISPLAY=:0.0' before any graphical command knows where to display things to.
 
Old 06-19-2008, 06:43 PM   #3
Mr. C.
Senior Member
 
Registered: Jun 2008
Posts: 2,529

Rep: Reputation: 62
Set the display host specifically:

--display=myhost:0.0

or

--display=localhost:0.0
 
Old 06-20-2008, 10:26 AM   #4
rose_bud4201
Member
 
Registered: Aug 2002
Location: St Louis, MO
Distribution: Xubuntu, RHEL, Solaris 10
Posts: 929

Original Poster
Rep: Reputation: 30
Ah-ha. It took some tinkering, and this thread, but the ultimate solution was to run

Code:
xhost local:root
And then having the script:
Code:
    ...
    error=`nautilus --display=:0.0 /mnt/public/Documents/`;
    echo $error;
    ...
Thank you both!
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
bash script running by cron fakie_flip Programming 17 12-24-2007 11:26 PM
help: using cron + my bash script --> don't want mail from script beeblequix Linux - General 7 11-23-2007 10:25 PM
Weird Nautilus Bash Script Problem fatsheep Programming 2 11-19-2006 05:51 PM
opening new bash tabs or consoles from a script Nice-n-Slow Programming 7 07-12-2004 10:25 AM
bash script from cron kubla Programming 3 01-22-2004 05:30 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 03:52 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration