Pardon my novice-ness but stuck with what might be a simple question yet wasn’t able to find an answer here:
Context is that I think about running AfO/Shortcuts on a simple Mac to carry out automatic “routines”. These routines include “Notes for Calendar Events”, “Sync Contacts with Notes”, or simply the daily creation of a daily note.
My hope is that this keeps this routines run stable and continuous (not being reliant on powering up Obsidian on a device).
My question is: Can the Mac be in ‘sleep’ and would start itself (or would it make sense to start it up at a specific time e.g. at 00:10) or if I best have it run but could be with a locked screen.
In my blog, I show a way how you can schedule the execution of Shortcuts via the launchd service with a LaunchAgent (Periodic Execution of Apple Shortcuts with launchd). This should work as well if the Mac is locked and the user is still logged in. Without the user being logged on, it might work with a LaunchDaemon instead of a LaunchAgent. But I didn’t test it. Since my scripts run mostly every few minutes, it wasn’t so important to me.
Normally, you can’t run a script when the Mac sleeps, but there might be some workarounds with caffeinate or with pmset, maybe in this case, a search engine might help.
In some cases, it might be easier to run a shell, Python script, or an AppleScript to create a new note special if you want to avoid Obsidian from running.
I’m on the go at the moment, so just as an addendum to what @leif said – all that, yes, but if you’re not into hardcore scripting, maybe take a look at Shortery for macOS which lets you run workflows at a particular time (among other things). Disclaimer: I’ve yet to give it a go myself, so I have no personal experience with it.
@czottmann is right. I forgot about Shortery. I used it for a few months for making backups of my vault when starting Obsidian, to have always a copy of my vault before I messed it up. I also wrote an article about Shortery, but only in German.
There are a special setting that ensures that a shortcuts is also triggerd when the Mac is locked. Another general setting prevents the Mac from sleeping, so that all shortcuts can be triggered. However, I only used Shortly for one specific case — when launching an application, so I also don’t have any experience with how reliable the other triggers are. Last summer, there was a 7-day trial period, but I can’t say whether that is still being offered. There is no indication of it on either the website or the Apple Store