user2601126
user2601126

Reputation: 19

R script doesn't run from crontab after a while

I've been troubleshooting this for sometime now. I'm getting some quite unexpected behaviour. I've place a job in /etc/crontab to be run bihourly. It's an R script that produces a png graphic displayed on my server's webpage. It's called in the form:

0,30 * * * * my_user Rscript /path/to/file

What's odd is that it works for an hour or so before the graphic stops updating. If I ssh into the machine and then edit /etc/crontab without even changing anything, it'll start running again. Anyone know what might cause such an issue?

EDIT: I messed around with it a bit more, and it's getting even weirder. I'm running a PHP file from cron that scrapes some text and writes it to file. The PHP continues to work even when R has ceased to run.

Upvotes: 1

Views: 148

Answers (1)

Mehrad
Mehrad

Reputation: 3829

If you want something to run once every two hours, you will have to use the slash, "/", character in your field. The slash character is the "step" character. In the case of a two hourly schedule, your time component of your cron file will read:

0 */2 * * *

The second field, "*/2", means every alternate hour.

Similarly, if you want something to run every 3 hours, you can change that field to "*/3", and so on.

bihourly: Occurring once every two hours.

Upvotes: 1

Related Questions