Cron job Powershell Script

Hello all. I’m hoping someone can help with my syntax here. I’ve been wanting to implement this script for a while, finally set to it today. Manual invocation works just fine. But when I tried to set it up with cron it just doesn’t run.


What I have done:

I have edited crontab -e with

0 */6 * * * pwsh /Applications/Upgradinatorr/upgradinatorr.ps1 -apps radarr,sonarr


I have added /usr/sbin/cron & Terminal to Full Disk Access


I set it around 3-4p. Didn’t run at 6p or 12a.


I’m assuming it’s because of the extra pwsh command there but I don’t know what I’m doing so…


Any advice would be greatly appreciated!!

Mac mini, macOS 14.4

Posted on Mar 21, 2024 9:22 PM

Reply
Question marked as Top-ranking reply

Posted on Mar 22, 2024 7:48 AM

Homebrew should have installed the pwsh binary in /opt/homebrew/bin on an M-series Apple Silicon Mac, or /usr/local/bin on an Intel Mac. Use that shorter path for the Powershell binary in hopes that Cron can resolve it.

8 replies

Mar 22, 2024 7:10 AM in response to rothnd

Cron doesn't know where to find Powershell (pwsh). Try using the full path to pwsh prior to your script name.


Powershell might be your only recourse on Windows, but it is not the de facto, nor de jure recommended scripting solution for macOS and you will find an absolute dearth of support here for it. MacOS, being a UNIX operating system has several supported scripting solutions available as alternatives to Powershell, and a wider audience able to provide support here in these communities.

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

Cron job Powershell Script

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.