-1

I have created an r-script in the folder "csv_file"

marc@Marc-Linux:~/csv_file$ ls
8388.26580527145.csv  csv_file.Rproj  excel  source  write_csv2.R

Now I would like to create a crontab that executes this file every five minutes till 10am. Therefore I wrote the following

  #open crontab
  crontab -e
  #add to file
  */5 10 * * * ~/csv_file/write_csv2.R

This however does not seem to work. That makes sense cause when I try to run

  marc@Marc-Linux:~$ ~/csv_file/write_csv2.R

I get the following error:

  -bash: /home/marc/csv_file/write_csv2.R: Permission denied

Any thoughts what goes wrong here?

John Dwyer
  • 189
  • 2
  • 13

1 Answers1

2

make it executable first, using

chmod +x  ~/csv_file/write_csv2/filename.r

and the execute it using ./filename.r

Ankit Deshpande
  • 3,476
  • 1
  • 29
  • 42
  • on cron he needs path off file, best if use full path – abkrim Apr 29 '16 at 08:24
  • Indeed, `~` is a Bashism, and will not work in `cron`, which requires pure `sh` syntax. But `cron` runs from your home directory, so you can simply say `./csv_file/write_csv2.R` in the `crontab` file. – tripleee Sep 28 '16 at 08:19