I need to load a page once per hour and execute the javascript on that page. I currently load the page manually with Firefox, but I would like to automate this by running a cron job on the server, which is Ubuntu Server 8.04 LTS.

Some web searching suggests that the best thing would be to run firefox -remote openurl(...) and let gecko run the javascript, but this requires X11 which I don't know how to simulate on a server install.

So essentially I want an hourly job to run firefox in a simulated environment and discard the output. (I'm not wed to firefox... I'd happily take a wget-like command that executes javascript.)


3 Answers 3


Just to add this to the mix, we ended up using HTMLUnit instead of the above.


You can run a graphical browser (e.g. Firefox) that's displaying in a virtual X server (Xvfb). See How can I run Firefox on Linux headlessly (i.e. without requiring libgtk-x11-2.0.so.0)?, and perhaps also How do I start Xvfb on startup on Debian?.

Elinks is a text mode browser with optional Javascript support. The version in Ubuntu 8.04 is compiled without the JS support, so you'd have to compile your own and link it with the Mozilla SpiderMonkey JavaScript library. These instructions in the manual may help.


You could try http://www.phantomjs.org/ a headless WebKit browser.

  • Thanks for the pointer, Joby, but it looks like PhantomJS requires Xvfb anyway (ie, it's not really headless) so I'm probably just going to use Firefox (which I don't have to build myself).
    – Fixee
    Apr 5, 2011 at 0:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.