Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Crontab is not running local/bin/ script. Catalina, BigSur

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, I write crontab -e, then edit it to */1 * * * * cliclick -w 1 m:3,3 (for example) - which mean repeat click in x=3;y=3 every 1 min. And nothing has changed. But, when I use just this command from the terminal everything is ok.

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

Maybe, I do something wrong? UPDATE: Full disk access crontab has.

UPDATE2: I tried do it again on the BigSur. First of all I use a more simple command like echo:

* * * * * echo 'test' >> /*/Desktop/text.txt And it works well. After that, I write my own script.sh

echo '2test' >> /Users/***/Desktop/t.txt
/usr/local/bin/cliclick -w 1 m:1,3
cliclick -w 1 m:55,44

And it the cliclick not working, as the other bin files located in /usr/local/bin/ (cliclick located in this path)

Note, that if I execute ./script.sh then cliclick works fine in both cases.

I thoroughly googled and found that run cliclick (and other) is NOT possible though crontab: https://github.com/BlueM/cliclick/issues/103

like image 597
0x0000dead Avatar asked Dec 01 '19 07:12

0x0000dead


1 Answers

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/

like image 161
roNn23 Avatar answered Sep 20 '22 13:09

roNn23