The Church Media Community
Equipping You to Communicate Effectively
support CMN & share a
library of 19K+ images, videos, etc
Go Pro!
 
Go Back   The Church Media Community > Computers > Linux
Forgot Password?
                          Register

Reply
 
Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old Friday, October 24th, 2008, 06:36 PM
TMcKellar's Avatar
Church Media Regular

 
 Join Date: Nov 2005 
 Last Online: Thursday, February 9th, 2012 
Cron

Howdy folks, Have a question about cron. I'm trying to set it up so I can run an OpenOffice.org Impress presentation at a certain time. I however cannot get cron to do it. I can run this and it will work fine from a terminal:
Code:
/usr/bin/openoffice -show /home/tmckellar/Dropbox/Audio_Training_Outline.ppt
I even made a script to run this command and it will run it fine. But for whatever reason that I can't decipher cron will run the script but won't open the gui. I have my script set to write to a .log file and it writes to it every time but the app never opens up. I've tried it with other gui based programs too and still get nothing. I've tried both the "env" and "export DISPLAY=:0.0" variables in crontab and in the script and still nothing. Anybody have any ideas. I'm trying to run this from Ubuntu 8.04. Thanks for the future help.
Reply With Quote Start a New Topic From This Comment
  #2 (permalink)  
Old Friday, October 24th, 2008, 09:38 PM
waynehoskins's Avatar
The Crazy Analog Guy
Become a CMN Professional Member!

 
 Join Date: May 2006 
 Last Online: Today 
The first thing I'd try is to launch it from the user's crontab rather than through cron.daily or hourly or whatever. (and it may well be that's what you're doing already)

I wrote a little script for automating my audio recording in the same manner the other week.

The only other thing I can think of (off the top of my head) is that it might have to be launched from within the GUI environment.

What I'd do is add some more diagnostics to the script, logging important variables and such, so you can see where it's breaking. You could also perhaps tee the launch script into a log file, so in theory any errors that get printed to the "console" also get printed to the logfile.

I wonder if gnome has a crontab interface widget?
Reply With Quote Start a New Topic From This Comment
  #3 (permalink)  
Old Friday, October 24th, 2008, 11:20 PM
TMcKellar's Avatar
Church Media Regular

 
 Join Date: Nov 2005 
 Last Online: Thursday, February 9th, 2012 
Gnome has the Scheduled Task menu item under preferences. I've tried using that and it still doesn't give me anything. Go figure though, it works 100% flawlessly on my wifes Debian computer. I've tried using other programs in crontab like firefox and gedit and don't get even as much as a peep out of them either. This isn't an immediate need but I'd like to get it setup for some future use at church.
Reply With Quote Start a New Topic From This Comment
  #4 (permalink)  
Old Friday, October 24th, 2008, 11:32 PM
waynehoskins's Avatar
The Crazy Analog Guy
Become a CMN Professional Member!

 
 Join Date: May 2006 
 Last Online: Today 
Crazy idea: is the script world-executable? It probably shouldn't make a difference (since it's running as that user), but it might be worth a look.

Weird. I had no trouble crontabbing the audio recording under Hardy, but then again I'm using arecord from the command line rather than something that runs under gdm, so that may be a difference.
Reply With Quote Start a New Topic From This Comment
  #5 (permalink)  
Old Friday, October 24th, 2008, 11:39 PM
TMcKellar's Avatar
Church Media Regular

 
 Join Date: Nov 2005 
 Last Online: Thursday, February 9th, 2012 
Here's something at least. I'm trying this script to try and sort it out. The script itself works fine. It does exactly what it is supposed to if ran solo. But ran from cron all it does is echo the "Firefox is Running" phrase so the script itself is running. Same as the impress script just without running the gui. I'm guessing then that there is something in this that cron can't handle so it spits out "Firefox is Running" no matter if it is or isn't.
Code:
#!/bin/bash

FF=`ps aux | grep firefox-bin | wc -l`
 
if [ "" == 1 ];
then
	echo "Starting Firefox: $(date)" >> /home/tmckellar/Desktop/ff.log && env DISPLAY=:0.0 /usr/bin/firefox-3.0
else
	echo "Firefox running: $(date)" >> /home/tmckellar/Desktop/ff.log
fi
Reply With Quote Start a New Topic From This Comment
  #6 (permalink)  
Old Saturday, October 25th, 2008, 01:23 PM
sadlerjon's Avatar
Having fun, yet?
Become a CMN Professional Member!

 
 Join Date: Jun 2008 
 Last Online: Monday, March 7th, 2011 
Likely impress doesn't have access to the display that you want this to appear on. While performing "env DISPLAY=:0.0" or "set DISPLAY=:0.0; export DISPLAY" tells impress which display to use, it won't be able to use it if it cannot provide the xauth authorization key to the X server. You can get around this using two different methods:

1) tell the X server that you authorize non-authorized xwire sessions from a specific machine. You can do this by running the following command from a terminal running on the display you want to run the impress session on (i.e. display :0.0):
xauth +127.0.0.1
This will allow any program running on the machine identified by the IP address 127.0.0.1 (the local machine loopback) to connect to the X server until the X server restarts (i.e. the machine reboots). You have to do this from a terminal running on that display as the communications between the xauth program and the X server will inherit the authorization key from the terminal environment.

2) pass the xauth authorization key to impress to give to the X server when it starts up the xwire connection to the X server. While this is a whole lot more secure (i.e. it keeps other programs (such as rogue keylogger) running on your machine from accessing the screen/keyboard without having the authorization key) it requires a whole lot more work. If you want to use this approach, I can dig around to get the commands... But it is a bunch more work.

Hope this helps...
Reply With Quote Start a New Topic From This Comment
  #7 (permalink)  
Old Saturday, October 25th, 2008, 01:41 PM
TMcKellar's Avatar
Church Media Regular

 
 Join Date: Nov 2005 
 Last Online: Thursday, February 9th, 2012 
I think passing the xauth command for just Openoffice.org will work. If you do xauth +127.0.0.1, can you undo it? I might try that once I know for sure i can undo it or you are able to dig up the command to do it just for Openoffice.org. I think that may eventually do the trick. I was playing around with cron and vlc today though and I got that to work no problem. We have some old computers at church I might throw Ubuntu server or Debian on to stream the service around the building.
Reply With Quote Start a New Topic From This Comment
  #8 (permalink)  
Old Saturday, October 25th, 2008, 01:52 PM
sadlerjon's Avatar
Having fun, yet?
Become a CMN Professional Member!

 
 Join Date: Jun 2008 
 Last Online: Monday, March 7th, 2011 
To remove host 127.0.0.1 from the X server's authorized clients list, you run the command:
xauth -127.0.0.1
Of course, this needs to be done from a session that is authorized (i.e. a terminal window on the display) and after it is run any application you run after this command that isn't authorized (i.e. isn't from a terminal on the display -- such as your cron) will not be able to access that X display.

I'm starting to dig up the info for the other approach...
Reply With Quote Start a New Topic From This Comment
Reply

  The Church Media Community > Computers > Linux

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:



Add to Google


Register Now for FREE!
Our records show you have not yet registered to our community. To sign up for your FREE account INSTANTLY fill out the form below!

Username: Password: Confirm Password: E-Mail: Confirm E-Mail:
Agree to forum rules 


All times are GMT -6. The time now is 06:13 PM.

   
 
© 1995-2008, ChurchMedia™, ChurchMedia LLC

SEO by vBSEO 3.1.0