0

I created a small workflow with the Automator App, and I want it executed periodically. For that I created an entry in crontab. The problem is that running the workflow straight from the Terminal works perfectly, but when executed from crontab, the "Connect To Servers" stage fails with the following error:

The action “Connect to Servers” encountered an error: “Failed to connect to server “smb://andreas@"serverIp"”.”

The server is definitely available, and indeed, running the workflow from within the App or using the exact same command I entered in the crontab file in the Terminal works perfectly.

This is my crontab:

* * * * * /usr/bin/automator /<path>/<filename>.workflow >> /"path"/"filename".workflow.out 2>&1

And again, running

/usr/bin/automator /<path>/<filename>.workflow >> /"path"/"filename".workflow.out 2>&1

in the terminal works.

What's the difference and how can I fix it?

UPDATE: I don't think it's missing env variables. I used the env command in my normal terminal and pasted all the declarations into the crontab file to no avail.

UPDATE 2: I switched to using launchd as a workaround, but I'm still curious as to why it didn't work with cron.

  • Can you add a screenshot of the workflow? – nohillside Sep 6 '19 at 18:33
  • I can, but the problem definitly isn't in the workflow. The workflow works fine when run in Automator, in the terminal and using launchd. – Andreas Hartmann Sep 6 '19 at 19:05
  • Does the server connection depend on a password stored in your keychain? 'Cause a cron job won't have access to that. – Gordon Davisson Sep 6 '19 at 19:16
  • Does the ENV variables include PATH? That would be the one that I'd want to check first. – TJ Luoma Sep 6 '19 at 21:15
  • apple.stackexchange.com/questions/372768/… Shows how to check disk access permission for cron – bmike Oct 17 '19 at 10:51
1

Might you be running a version of macOS where cron needs to be granted disk access?

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .