tags:

views:

53

answers:

2

i got a file fetch.php

for now i am manually calling it from a bookmark once a day to execute the script.

i want to set kind of like a cron..that just goes to fetch.php once a day..

is it possible..

the fetch.php file has a html and bunch of javascript thats why cron doesn't work..

thanks... if you need clarification let me know..

+1  A: 

in the crontab you can run it with a lynx command

example :

lynx -dump http://your.website.com > /dev/null

EDIT:

the problem is that lynxs not run javascript.

so you need to find a command line web browser that support javascript , it Not quite simple.

check a 'links' or 'w3m'

read more about in this post :

http://www.linuxquestions.org/questions/linux-software-2/is-there-a-browser-command-line-tool-for-testing-javascript-websites-359260/

Haim Evgi
I doubt lynx does Javascript.
deceze
@deceze you right
Haim Evgi
A: 

Since JavaScript has to be executed, it sounds like it has to be run in a browser. Unless you're willing to add a lot more complexity, I'd go with one of these routes:

  • Use cron or Task Scheduler to launch the page in a web browser. Use javascript to have the page close itself (its tab) after it's loaded.
    cron: * 9 * * * /usr/bin/firefox "http://localhost/cron.php" (may or may not work)
    JavaScript: function all_done() { window.close(); }
  • Leave a tab open 24/7 and use ReloadEvery or something similar.
Tim