How to open an url in Firefox via cron (cron jobs scheduling) [duplicate]

Solution 1:

to execute a bash script via cron i would use

30 14 * * * /bin/bash /home/flicker/open-web.sh >/dev/null 2>&1

To call a web page/URL via cron & curl

30 14 * * * /usr/bin/curl  http://funkyname.com/blub.html >/dev/null 2>&1

Update:

After realizing you want to open an actual browser and NOT just calling a script - i guess i understood your case.

You can solve that without bash script - instead write all logic directly to your crontab.

for Chrome:

30 14 * * * export DISPLAY=:0 && google-chrome --new-window http://www.randomurl.com

for Firefox:

30 14 * * * export DISPLAY=:0 && firefox --new-window http://www.randomurl.com

Keep in mind:

The --new-window parameter is forcing the browser in charge to open a new window, if you don't want that, just remove that section.

To avoid noise output you can optional add >/dev/null 2>&1 at the end of your cron entry.