0

I have written a command file in mac which puts a particular file recognized by temp_todaysdate into s3 bucket and I am also printing size of the file(temp_todaysdate). When I am running this file manually in terminal, it is working fine i.e it is printing the size of file as well as putting the file to s3 bucket.

But when I am scheduling a cronjob to run this commnad file daily. I am getting a mail with the following error:

Size of file: 66520
./Bucket.command:line 10: aws2: command not found.

What can be done to resolve this error. Please help

prachi
  • 109
  • 1
  • 10
  • 2
    cron jobs run with a very minimal environment; `aws2` is probably not in its `PATH` (in which case this question is a duplicate of ["How to get CRON to call in the correct PATHs"](https://stackoverflow.com/questions/2388087/how-to-get-cron-to-call-in-the-correct-paths), and probably others -- very common problem). There are probably other environment dependencies in your that'll cause problems once you get that fixed, so be on the lookout for them. – Gordon Davisson Jan 08 '20 at 08:00
  • 1
    Either one, but if you set `PATH` you need to set it correctly — it should include the directory the executable is in, not the full path to the executable itself, *and* all the other standard binaries directories (something like `PATH=/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin`). – Gordon Davisson Jan 08 '20 at 09:38
  • Thank you so much @GordonDavisson :) . I added PATH and it is working now.. – prachi Jan 08 '20 at 10:12

0 Answers0