1

I wrote a bash script to display the current xkcd comic in my web browser (using the RXKCD package in R). I want to schedule this so that the current xkcd comic displays every morning at 8am when I get into work. However, crontab doesn't seem to want to cooperate with me. I've found lots of material online where crontab fails, but still can't seem to figure out what's wrong with my situation.

Here is the bash script:

#! /bin/bash
R CMD BATCH todaysXKCD.R

and here is 'todaysXKCD.R'

library(RXKCD)
getXKCD(html=T, display=F)

I've set up a crontab using crontab -e, and that looks like this:

SHELL=/bin/bash
PATH=/home/pfrater/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games
* * * * * root /bin/bash /home/pfrater/bashScripts/xkcd/todaysXKCD.sh

The script works perfectly when I call it from the command line, but not at all with cron. What am I doing wrong? Do I need to add the path for my bashscript to the PATH in the crontab?

Paul
  • 233

0 Answers0