I am working on a CentOS server and schedule a task with command at
# echo "touch a_long_file_name_file.txt" | at now + 1 minute
job 2 at Wed Oct 31 13:52:00 2018
One minute later,
# ls | grep a_long_file_name_file.tx
a_long_file_name_file.txt
the file was successful created.
However, if I run it locally on my macOS,
$ echo "touch a_long_file_name_file.txt" | at now + 1 minute
job 31 at Wed Oct 31 13:58:00 2018
Minutes later, if it failed to make such a file.
I checked the version of at
on the CentOS server
AUTHOR:
At was mostly written by Thomas Koenig, ig25@rz.uni-karlsruhe.de.
2009-11-14
In contrast, the macOS version
AUTHORS
At was mostly written by Thomas Koenig <ig25@rz.uni-karlsruhe.de>. The time parsing routines are
by
David Parsons <orc@pell.chi.il.us>, with minor enhancements by
Joe Halpin <joe.halpin@attbi.com>.
BSD January 13, 2002
I found that at
, atq
, atrm
are not of GNU coreutils.
$ ls /usr/local/opt/coreutils/libexec/gnubin/ | grep at
cat
date
pathchk
realpath
stat
truncate
How could I install the latest version of at
on macOS and make it work?
Best Answer
Instead of updating
at
and the associated tools on macOS, lets try to make the defaultat
on macOS work.The
at
manual on macOS says (my emphasis):Checking the
atrun
manual:What I think may be happening here, and what is prompting your other
at
-related questions, is that you just haven't enabledatrun
on your macOS installation.On macOS Mojave, in addition to running the above
launchctl
command (withsudo
), you will also have to add/usr/libexec/atrun
to the list of commands/applications that have "Full Disk Access" in the "Security & Privacy" preferences on the system. Note that I don't know the security implications of doing this. Personally, I have also added/usr/sbin/cron
there to get cron jobs to work (not shown in the screenshot below as this is from another computer).To add a command from the
/usr
path (which won't show up in the file selection dialog on macOS), press Cmd+Shift+G when the file selection dialog is open (after pressing the plus-icon/button in the bottom of the window).You do not need to reboot the machine after these changes. I have tested this on macOS Mojave 14.10.1.