Could someone provide some example usages for the at command? I'm finding the man super confusing.

$ man at

For example, if we wanted to run a command 10 minutes from now, can this be done using at? (and without using sleep)


Solution 1:

The time spec for "10 minutes from now" is now +10 minutes. For example,

echo 'open ~' | at now +10 minutes

However, the at system is disabled by default in macOS, as mentioned in the at man page:

IMPLEMENTATION NOTES
     Note that at is implemented through the launchd(8) daemon periodically
     invoking atrun(8), which is disabled by default.  See atrun(8) for infor-
     mation about enabling atrun.

The atrun man page says that you need to run

sudo launchctl load -w /System/Library/LaunchDaemons/com.apple.atrun.plist