How to use a cron job to open a web page in a browser

At work, I have a set of long-term goals I'm supposed to be making progress on over the year. As a way to remind myself about them, I have a cron job setup to open the URL with the goals on them every morning.

First, you need to create a bash script to open a webpage. Note that I'm setting the display so that when cron runs the job behind the scenes, it knows which display to use. I'm also using xdg-open, which will open a URL (or any document) in the currently registered application. In my case, that's Chrome.

export DISPLAY=:0

I saved this as ~/bin/ Next, you need to make it executable.

chmod +x ~/bin/

Finally, you need to schedule it in cron. Here is the syntax for running it every morning at 8AM.

>crontab -e
* 8 * * * /home/chase/bin/

I'm currently working at NerdWallet, a startup in San Francisco trying to bring clarity to all of life's financial decisions. We're hiring like crazy. Hit me up on Twitter, I would love to talk.

Follow @chase_seibert on Twitter