LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 03-20-2009, 01:33 PM   #1
labnotes_A91
LQ Newbie
 
Registered: Oct 2004
Posts: 3

Rep: Reputation: 0
Question launch firefox from a cron


I am trying to launch firefox using a cron. Here's my cron

03 * * * * DISPLAY=:0 /usr/bin/firefox

at 3 minutes past the hour or whatever time I put in the firefox does not open. If in a terminal window I execute xhost localhost before the cron runs firefox will open when the cron runs. Any idea how I can get the get the cron to open firefox. I have tried adding xhost localhost to the cron I have also tried running a bash sh with xhost in it and nothing. Any ideas would be great.

Thank you and have a great day
 
Old 03-20-2009, 02:56 PM   #2
rweaver
Senior Member
 
Registered: Dec 2008
Location: Louisville, OH
Distribution: Debian, CentOS, Slackware, RHEL, Gentoo
Posts: 1,833

Rep: Reputation: 167Reputation: 167
Quote:
Originally Posted by labnotes_A91 View Post
I am trying to launch firefox using a cron. Here's my cron

03 * * * * DISPLAY=:0 /usr/bin/firefox

at 3 minutes past the hour or whatever time I put in the firefox does not open. If in a terminal window I execute xhost localhost before the cron runs firefox will open when the cron runs. Any idea how I can get the get the cron to open firefox. I have tried adding xhost localhost to the cron I have also tried running a bash sh with xhost in it and nothing. Any ideas would be great.

Thank you and have a great day
I'm somewhat curious about why you would want to do this, but my suggestion would be to make a bash script.

Code:
#!/bin/bash
export DISPLAY=:0
xhost localhost
/usr/bin/firefox
Then change the cron:
03 * * * * /usr/local/bin/ffcron.sh
 
Old 03-20-2009, 03:23 PM   #3
labnotes_A91
LQ Newbie
 
Registered: Oct 2004
Posts: 3

Original Poster
Rep: Reputation: 0
Thank you. From a terminal window your script runs, but it does not run from the cron until I manually issue the xhost command. I am trying to do this because I have a program that runs with firefox to loginto a website and populate a form in evrey 30 minutes. The website then processes my input and sends an e-mail with the results.
 
Old 03-20-2009, 03:35 PM   #4
XavierP
Moderator
 
Registered: Nov 2002
Location: Kent, England
Distribution: Debian Testing
Posts: 19,192
Blog Entries: 4

Rep: Reputation: 475Reputation: 475Reputation: 475Reputation: 475Reputation: 475
Moved: This thread is more suitable in Linux-General and has been moved accordingly to help your thread/question get the exposure it deserves.
 
Old 03-20-2009, 03:58 PM   #5
cowlol
LQ Newbie
 
Registered: Feb 2009
Posts: 21

Rep: Reputation: 17
Cant you script lynx to do that instead?
 
Old 03-20-2009, 10:28 PM   #6
nflenz
Member
 
Registered: Feb 2006
Distribution: CRUX 2.4
Posts: 96

Rep: Reputation: 18
Configure your system to run xhost when X starts.

If you don't use a display manager, the command can be added to your ~/.xinitrc file. I think the config file for gdm is /etc/gdm/Presession/Default or something similar. I don't know anything about the other display managers.
 
  


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 On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Firefox shuts down after first launch Aleksandersen Linux - Desktop 1 02-08-2007 04:39 PM
Thunderbird won't launch firefox OC_eobard Linux - Software 4 07-11-2006 08:29 PM
Firefox launch problem onthos Linux - Software 2 10-23-2005 09:32 AM
firefox launch script curmudgeon42 Linux - Software 2 06-06-2004 09:20 PM
external launch of firefox... Borelian Linux - Software 1 05-09-2004 06:50 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 05:57 PM.

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
Open Source Consulting | Domain Registration