Cron issues running very simple commands
I made a simple cron job by typing the following commands
crontab -e
then in the vi file that opens, I type
* * * * * * echo 'leon trozky' >> /Users/whitetiger/Desktop/foo.txt 2>&1
the file is foo.txt
indeed created, but its contents are
/bin/sh: Applications: command not found
I assume it has something to do with the PATH value cron
. Is there a way to set the PATH on a file cron
in such a way that when I transfer it to another Mac, I don't have to set the PATH manually? is it even a PATH problem?
+3
source to share
2 answers
Yes, your syntax is 1 * more than it should be, just adding more information, adding Red Cricket's answer, the 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)
0
source to share