Skip to main content
Question

Crontab in script


Forum|alt.badge.img+3

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

elliotjordan
Forum|alt.badge.img+12
  • Valued Contributor
  • 143 replies
  • November 28, 2021

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/


Forum|alt.badge.img+3
  • Author
  • New Contributor
  • 2 replies
  • December 2, 2021
elliotjordan wrote:

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


Reply


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings