openSUSE Forums > Programming/Scripting » Crontab for Firefox

Go Back   openSUSE Forums > Programming/Scripting
Forums FAQ Members List Search Today's Posts Mark Forums Read


Programming/Scripting Questions about programming, bash scripts, perl, php, cron jobs, ruby, python, etc.

Reply
Page 1 of 2 1 2
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 17-Oct-2009, 09:04
Student Penguin
 
Join Date: Dec 2008
Posts: 93
buugmenot hasn't been rated much yet
Default Crontab for Firefox

I wrote in crontab:

*/1 * * * * export DISPLAY=:0 && /home/niklas/Desktop/firefox.sh

but then there is always the message:
No protocol specified
No protocol specified
Error: cannot open display: :0

in /var/spool/mail/username

What did I wrong?
__________________
http://www.vic-fontaine.com/
Reply With Quote
  #2 (permalink)  
Old 17-Oct-2009, 10:20
hcvv's Avatar
Wise Penguin
 
Join Date: Jun 2008
Location: Netherlands
Posts: 1,908
hcvv 's reputation will be famous soon enoughhcvv 's reputation will be famous soon enoughhcvv 's reputation will be famous soon enough
Default Re: Crontab for Firefox

Is what you show the ouput of
Code:
crontab -l
Code:
export DISPLAY=:0 && /home/niklas/Desktop/firefox.sh
This is a bit strange (I a still doubting what this does) . Should be:
Code:
DISPLAY=:0 /home/niklas/Desktop/firefox.sh
In who's crontab? Only the user that is using Diaplay :0 may open a window (without further allowance).

What is the executable firefox.sh supposed to do? I can make a guess, but guessing is dangerous in a computer envirinment. One must be certain. so what about the ouput of
Code:
cat  /home/niklas/Desktop/firefox.sh
(when it is not to long).
__________________
Henk van Velden
Reply With Quote
  #3 (permalink)  
Old 17-Oct-2009, 11:00
Student Penguin
 
Join Date: Dec 2008
Posts: 93
buugmenot hasn't been rated much yet
Default Re: Crontab for Firefox

in the firefox.sh is just a link to a website, that should be opened
like this:

Code:
firefox http://www.chip.de/
I think it is in the crontab of the user because I did it from the console, after I logged in as my user
__________________
http://www.vic-fontaine.com/
Reply With Quote
  #4 (permalink)  
Old 17-Oct-2009, 11:08
Explorer Penguin
 
Join Date: Apr 2009
Posts: 687
ab@novell.com hasn't been rated much yet
Default Re: Crontab for Firefox

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Agreed on all points. What is your real goal? The */1 is redundant and
should just be * as it means the same thing. The use of 'export' and '&&'
is redundant and can be simplified to what was shown. Also loading
Firefox every single minute seems a little bit crazy if that is what youa
re doing, which is why I ask what you are doing. If you want something
GUI-ish loaded you also need to, as mentioned previously, allow that from
the GUI side as the user running the X session with something like
'xhost'. The general open-it-up-for-everybody method that you should
probably not use (but which works in any case) is 'xhost +' but, again,
you should probably be a bit more restrictive than that if you allow
anybody on your machine besides yourself. If you are just hoping to have
Firefox always loaded that is fine but if you are trying to pull down
files or hit a page every minute there are much better ways to do that
with things like 'wget' and 'curl' which are already on your machine in
most cases.

Good luck.





hcvv wrote:
> Is what you show the ouput of
>
> Code:
> --------------------
> crontab -l
> --------------------
>
>
>
> Code:
> --------------------
> export DISPLAY=:0 && /home/niklas/Desktop/firefox.sh
> --------------------
>
> This is a bit strange (I a still doubting what this does) . Should be:
>
> Code:
> --------------------
> DISPLAY=:0 /home/niklas/Desktop/firefox.sh
> --------------------
>
>
> In who's crontab? Only the user that is using Diaplay :0 may open a
> window (without further allowance).
>
> What is the executable firefox.sh supposed to do? I can make a guess,
> but guessing is dangerous in a computer envirinment. One must be
> certain. so what about the ouput of
>
> Code:
> --------------------
> cat /home/niklas/Desktop/firefox.sh
> --------------------
>
> (when it is not to long).
>
>

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.9 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iQIcBAEBAgAGBQJK2ev7AAoJEF+XTK08PnB5fckQANIL3MX+dM fXOBEhzJQNfSLD
rJawRcn6hu75P8qBckP9jnkYWeMuOMTGcvqTcT73exKP5JFiju QHREUtotIcrT0t
xFQLUo8R7XIgxPZsNTAbdOu2lbnCjld3EYZs/8hgRY66B/NgMuLwaZ5V/+vBBI9n
j6dKJwuaaUiFCFyptw+BS4UShhYde+RRx5sbBKuYa7L8FcWpfR 4r5+DQb6h/jzsW
Vaun0nli/Ip8JM4mePe3NfZ7dkFc6sP/QqLozzD3UbeEOU+C46TszIEvJXCW3/5l
BZyRN5JrDzyAM3/do2MLxEmdPuERVg7DkoAf7RUC9/GI9S1vKMlP+odxXEtdey0a
Cv7n7t64QVObri06pxid8w1+VtNLOqJo/zgzd8r1OCyocnUDoum7t104Ss1ofJfi
MdtWA2v0Apv7l1ebqBjs/O0HLpEbtNC6NWvN6PglpUjJ4CTxlWq2VRJH85pj0Nv6
9F+QD8sdzu8PzK+wh2lWu3SkpS+basFcL2l6L4EF2PqM+Hfoqb raMS160toNh1sR
N2/LW90wwuok2+SRSyzsZsz+mi7DpsMk1IVNvm9ejWt5ELl34f3Xq o/FZ/q3DlyR
0lxvZnimB8ZbvStcmo1p6hcejPXiBVpxnMAvBkdc1x4CzPtb31 kQGb9Mt/CbileE
E9/Po5RlEorAw9tB9fKB
=5a9m
-----END PGP SIGNATURE-----
Reply With Quote
  #5 (permalink)  
Old 17-Oct-2009, 11:10
Student Penguin
 
Join Date: Dec 2008
Posts: 93
buugmenot hasn't been rated much yet
Default Re: Crontab for Firefox

Now I have written the content of the firefox.sh in the crontab.
Now it looks like:

Code:
# DO NOT EDIT THIS FILE - edit the master and reinstall.
# (/tmp/tmp4Aly0H installed on Sat Oct 17 18:07:54 2009)
# (Cron version V5.0 -- $Id: crontab.c,v 1.12 2004/01/23 18:56:42 vixie Exp $)
*/1 * * * * DISPLAY=:0 firefox http://www.chip.de/ # JOB_ID_2
Still the same error.
__________________
http://www.vic-fontaine.com/
Reply With Quote
  #6 (permalink)  
Old 17-Oct-2009, 11:30
hcvv's Avatar
Wise Penguin
 
Join Date: Jun 2008
Location: Netherlands
Posts: 1,908
hcvv 's reputation will be famous soon enoughhcvv 's reputation will be famous soon enoughhcvv 's reputation will be famous soon enough
Default Re: Crontab for Firefox

Quote:
Originally Posted by buugmenot View Post
Now I have written the content of the firefox.sh in the crontab.
Now it looks like:

Code:
# DO NOT EDIT THIS FILE - edit the master and reinstall.
# (/tmp/tmp4Aly0H installed on Sat Oct 17 18:07:54 2009)
# (Cron version V5.0 -- $Id: crontab.c,v 1.12 2004/01/23 18:56:42 vixie Exp $)
*/1 * * * * DISPLAY=:0 firefox http://www.chip.de/ # JOB_ID_2
Still the same error.
That proves that you are doing the same thing as before, but you have short cutted a few things, which is always good because it makes things clearer.

As you post is only 4 minutes after the one from ab@novell.com is suppose you did not do the xhost + in your running GUI. You should also think about all his remarks about starting FF every minute.
__________________
Henk van Velden
Reply With Quote
  #7 (permalink)  
Old 18-Oct-2009, 04:12
Student Penguin
 
Join Date: Dec 2008
Posts: 93
buugmenot hasn't been rated much yet
Default Re: Crontab for Firefox

That with /1 was just an example.
Yes curl seems to be working, but I want to know how to start a GUI programm all the same.
xhost +myusername
then appears:
bad hostname: my username
__________________
http://www.vic-fontaine.com/
Reply With Quote
  #8 (permalink)  
Old 18-Oct-2009, 04:15
Explorer Penguin
 
Join Date: Jul 2008
Location: Voorhout, Netherlands
Posts: 231
LittleRedRooster is on a distinguished reputation roadLittleRedRooster is on a distinguished reputation road
Default Re: Crontab for Firefox

ab@novell.com wrote:
> Agreed on all points. What is your real goal? The */1 is redundant and
> should just be * as it means the same thing. The use of 'export' and '&&'
> is redundant and can be simplified to what was shown. Also loading
> Firefox every single minute seems a little bit crazy if that is what youa
> re doing, which is why I ask what you are doing. If you want something


I would guess that the OP tries to reload this website in a 60sec interval.
The solution is simple: get the 'ReloadEvery' plugin for Ff.
Ff can be auto-loaded when you log-in of course, so the whole process is
without user interaction.

Theo
Reply With Quote
  #9 (permalink)  
Old 18-Oct-2009, 04:24
Student Penguin
 
Join Date: Dec 2008
Posts: 93
buugmenot hasn't been rated much yet
Default Re: Crontab for Firefox

Now there is just the question how to start a grafical program in general
__________________
http://www.vic-fontaine.com/
Reply With Quote
  #10 (permalink)  
Old 18-Oct-2009, 04:53
Explorer Penguin
 
Join Date: Jul 2008
Location: Voorhout, Netherlands
Posts: 231
LittleRedRooster is on a distinguished reputation roadLittleRedRooster is on a distinguished reputation road
Default Re: Crontab for Firefox

buugmenot wrote:
> Now there is just the question how to start a grafical program in
> general
>
>


Read this please.
http://www.catb.org/~esr/faqs/smart-questions.html

Without telling what you try to accomplish your question doesn't
make sense, as it's unlikely you want to hear the obvious answer.

Theo
Reply With Quote
Reply
Page 1 of 2 1 2

Bookmarks


Thread Tools
Display Modes

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
Trackbacks are On
Pingbacks are On
Refbacks are On




 

Search Engine Friendly URLs by vBSEO 3.3.0 RC2