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?
You might discover that your job works when run via the command line, but won't run via cron. This may be due to the location you're executing from or the PATH you're using. The use of relative paths is a common cause of cron issues. In cron, the PATH is set by default to /bin:/usr/bin .
Method # 1: By Checking the Status of Cron Service Running the “systemctl” command along with the status flag will check the status of the Cron service as shown in the image below. If the status is “Active (Running)” then it will be confirmed that crontab is working perfectly well, otherwise not.
It is a wildcard for every part of the cron schedule expression. So * * * * * means every minute of every hour of every day of every month and every day of the week .
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 *
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With