Crontab in script

barmaglot
New Contributor

Hello.
There is a script distributed by the policy:

echo "1 * * * * ~/userscript > /Users/$3/crontab

crontab -u "$3" /Users/$3/crontab

But it fails with an error:

Script result: crontab: tmp/tmp.3896: Operation not permitted

In the console, I add the terminal application to the full access list and it works from the terminal, but what can I add in privacy for policies?

2 REPLIES 2

elliotjordan
Contributor III

Hi @barmaglot - Could you provide a bit more info about what you're trying to accomplish? It seems like you might be better served by installing a simple LaunchAgent that references the script with a `StartInterval` or `StartCalendarInterval`. A good resource for LaunchAgent info is https://launchd.info/

The user must execute the command in the terminal

crontab ~ / crontab

or

launchctl load ~/Library/LaunchAgents/com.apple.myservice.plist

A dialog box appears asking if you want the terminal to write to the disk

When running a script from Jamf, the dialog box does not appear and an filed message appears in the Jamf policy log