Reputation: 776
I have made a simple cron job by typing the following commands
crontab -e
then in the vi file opened I types
* * * * * * echo 'leon trozky' >> /Users/whitetiger/Desktop/foo.txt 2>&1
the file foo.txt
indeed gets created, but its content is
/bin/sh: Applications: command not found
I'm guessing this has to do with the PATH value of cron
. Is there any way to set the PATH in the cron
file such that when I transfer it to another mac I won't have to set the PATH manually? is this even a PATH problem?
Upvotes: 6
Views: 1397
Reputation: 817
Yeah your syntax is 1 * more than it should be, just providing more info adding to Red Cricket's answer, crontab syntax should be
* * * * * command to execute
│ │ │ │ │
│ │ │ │ └─── day of week (0 - 6) (0 to 6 are Sunday to Saturday, or use names; 7 is Sunday, the same as 0)
│ │ │ └──────── month (1 - 12)
│ │ └───────────── day of month (1 - 31)
│ └────────────────── hour (0 - 23)
└─────────────────────── min (0 - 59)
Upvotes: 1
Reputation: 10480
I think you got one too many *
's there. And yes you can set the PATH variable in cron. A couple of ways. But your problem is the extra *
.
Upvotes: 9