I know launchd is the way to go, but would really need to use cron in this situation.
I'm trying to run the following command through cron:
rclone copy /Users/x123/Downloads/torrents mega:torrents -q && rm -f /Users/x123/Downloads/torrents/*.*
This works ok on terminal, however when I go crontab -eand add it, it doesn't run.
I also tried adding the command to an .sh script, making executable and running it with cron, also no good.
I'm honestly at loss. I tried touching a file, and it works. For example:
*/5 * * * * touch ~/Downloads/torrents/Test1.txt
Creates the file just ok, however:
*/5 * * * * rclone copy /Users/x123/Downloads/torrents mega:torrents -q && rm -f /Users/x123/Downloads/torrents/*.*
Doesn't, neither does:
*/5 * * * * cd /Users/x123/ && ./script.sh (which the script contains the command)
Worth noting: cron, crontab have Full Disk access.
Should I take this inquiry to rclone forum? Any help understanding what's going on would be super appreciated!
So I learned a few things:
When working with
cronand it seems to not work, check yourmailinbox, it helps!Always use full paths when dealing with
cronIf you instruct
crona command, and then decide to move all this to a script, check and recheck your script. In my case, I was so wrapped up in full paths, that I forgot about the command verbs!Thank you all guys for the continuous and great support. It's extremely valuable!
rm -f /Users/x123/Downloads/torrents/*.*works as expected. It might be easer to put everything into a shell script (and use absolute paths there). – nohillside Nov 12 '22 at 09:43/usr/local/bin/rclone /Users/x123/Downloads/torrents mega:torrents -q && /bin/rm -f /Users/x123/Downloads/torrents/*.*? Because that's what I tried and still not getting any action. – mariano-daniel Nov 12 '22 at 14:20/usr/local/bin/rclone /Users/x123/Downloads/torrents mega:torrents -q > /tmp/cron.out 2>&1to capture any output, and look at/tmp/cron.outafterwards to check for errors etc. – nohillside Nov 12 '22 at 16:17cronshould be spamming your mailbox with error messages. Have you checked your mailbox? – fd0 Nov 12 '22 at 19:49