

You can change the integer values in the array for the key StartCalendarInterval to get the timing that suits you. plist will cause ~/echodatetime.sh to be executed at the following times every day:
#T j hammerspoon full#
plist file in ~/Library/LaunchAgents/:ĮDIT: NOTE! DO NOT USE ~/ as shortcut for user's home directory! You must use a full path specification, or it won't work. Name the script echodatetime.sh & make it executable: $ chmod 755 ~/echodatetime.sh Create a script in your home directory ( ~/) to output the date and time whenever it's run:Įcho Current Date and Time is: $.Note that it is also possible to create Global Agent, or a Global Daemon that runs for multiple/all users, but we'll leave that for another day. The scope of a User Agent is that it only runs for one user.
#T j hammerspoon how to#
Here's an example of how to use launchdto create a User Agent.

If multiple intervals transpire before the computer is woken, those events will be coalesced into one event upon wake from sleep. Unlike cron which skips job invocations when the computer is asleep, launchd will start the job the next time the computer wakes up. plist to schedule the time to run your job/script is StartCalendarInterval. plist "manually" with a text editor.Īs mentioned above, the configuration key you need to use in your.

And of course you can avoid 3rd party software completely by simply creating the required. plist file contains the instructions that will be used by launchd to start your program, and can be very simple. plist, and can help managing & troubleshooting if that becomes necessary. LaunchControl is a GUI-based app used only to help you create/edit your. The only 3rd party tool you might want to use with it is LaunchControl (instead of the native launchctl). IMHO, launchd has an advantage because it is part of MacOS. If you schedule your script to run at (for example) 12:00 noon, BUT your mac is asleep at 12:00 noon, then your script will run as soon as your mac wakes up.If you schedule your script to run at (for example) 12:00 noon, AND your mac is awake at 12:00 noon, then your script will run at 12:00 noon.As long as your system isn't asleep the entire day, and it is scheduled using the StartCalendarInterval (see below), launchd will run your script once a day.
