cronjob get permission error for folders

I tried to write a script to clean up some folders e.g. ~/Downloads.

If I run the script in Terminal it works. If I add the script to a "crontab -e" it doesn't.

I wrote a test script to get some information about the environment:


test_cron.sh:

#!/bin/sh

echo "User $(whoami) in $SHELL"

ls ~/Downloads


crontab -e:

17 21 * * * ~/.services/test_cron.sh > ~/.services/cron_test.log 2>&1


cron_test.log:

User tim in /bin/sh

ls: /Users/tim/Downloads: Operation not permitted


Privacy & Security Settings:


I used MacOS 15.1.1


I would be grateful for any help.



Gepostet am 07. Dez. 2024 13:10

Antworten
2 Antworten

Dieser Thread wurde vom System oder dem Community-Team geschlossen. Du kannst alle Beiträge positiv bewerten, die du hilfreich findest, oder in der Community nach weiteren Antworten suchen.

cronjob get permission error for folders

Willkommen in der Apple Support Community
Ein Forum, in dem Apple-Kunden sich gegenseitig mit ihren Produkten helfen. Melde dich mit deinem Apple Account an, um Mitglied zu werden.