Find the answer to your Linux question:
Results 1 to 2 of 2
Hello all. I have a script that has the line it and am trying to run that script as a cron job. Code: firefox ~/callGlenn.html & sleep 20 It works ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Feb 2004
    Location
    I'd rather be in Hawaii
    Posts
    52

    Calling website from cron job.


    Hello all.

    I have a script that has the line it and am trying to run that script as a cron job.
    Code:
    firefox ~/callGlenn.html & sleep 20
    It works fine when I start the script manually, but crashes when it is called by cron. The error in the output mail is:
    Code:
    xterm:  DISPLAY is not set
    What this script is doing is calling a local html page, that runs a javascript file, which in turn downloads a cgi script for a RealPlayer stream. This stream file is then parsed and recorded using mplayer, then converted to an mp3 with lame.

    How do I set the display for xterm. I looked thorugh the man page, but it only gave a very vague description of what the display actually was for.

    If any one could tell me how to accomplish this I would be very grateful. Or if there is a method other than using a web browser to basically "click a link" on some webpage I would love to hear about it.

    Thanks in advance.

  2. #2
    Linux Guru Cabhan's Avatar
    Join Date
    Jan 2005
    Location
    Seattle, WA, USA
    Posts
    3,252
    I would imagine that $DISPLAY is the variable holding the address of the X Server, and since cron is not being run from an X Server, this is empty.

    Having said that, I would imagine that you could call a script like the following from cron (assuming, of course, that you have an X Server running somewhere):

    Code:
    DISPLAY=:0.0
    firefox ~/callGlenn.html & ffpid=$!
    sleep 20
    kill $ffpid
    Alternatively, this might work:
    Code:
    wget --spider -i ~/callGlenn.html
    But I make no promises on the latter.

    Try these and lemme know if they work.

Posting Permissions

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