Crontab is not running my script. Catalina

岁酱吖の 提交于 2020-06-27 16:29:11

问题


I just have started to use crontab and have some problems with it. I have already read some posts about how to use it on macOS, but it still not working.

So, my task is very easy: I write crontab -e, then edit it to */1 * * * * cliclick -w 1 m:3,3 (for example) - which mean repeat every 1 min. And nothing has changed. But, when I use just this command from terminal everything is ok.

I have already try to create a script.sh file, and the same situation: from hand-command it works, and from crontab isn't.

By the way, if I use simple command, for example echo it isn't working too.

Maybe, I do something wrong, please help me.

PS: Full access to disk crontab has.

Thank you!


回答1:


My Problem was, that cron had no access to the Disk, so it couldn't run my script. I had to give Full Disk Access for /usr/sbin/cron

See this blog post: https://blog.bejarano.io/fixing-cron-jobs-in-mojave/




回答2:


You can check if there are any errors while running the cron by configuring it as below.

*/1 * * * * cliclick -w 1 m:3,3 >> output.log 2>&1

the last part 2>&1 will redirect the STDERR to the output.log as well.




回答3:


You need to authorize Full Disk Access for terminal.app in Settings>Security & Privacy>Privacy.



来源:https://stackoverflow.com/questions/59123499/crontab-is-not-running-my-script-catalina

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!