4

My at on Mac OS X 10.11 seems to be incapable of launching jobs. I tried:

echo "date > foo" | at now

Running atq afterwards shows the job queued and no file foo was created. To make sure the problem isn't a date mixup, I ran:

$ date && echo "date > foo" |  at now && atq

And both date and atq showed the same time.

I also checked for at.allow and at.deny files. /usr/lib/cron/at.deny exists but is empty and /usr/lib/cron/at.allow doesn't exist. According to the man page, that means that I am allowed to run it:

If _PERM_PATH/at.allow does not exist, _PERM_PATH/at.deny is checked,
every username not mentioned in it is then allowed to use at.

[...]

FILES
   _PERM_PATH/at.allow   allow permission control (/usr/lib/cron/at.allow)
   _PERM_PATH/at.deny    deny permission control (/usr/lib/cron/at.deny)

What am I doing wrong/what can I do to schedule this for later?

terdon
  • 234,489
  • 66
  • 447
  • 667
Christopher
  • 247
  • 2
  • 9
  • 2
    script.sh must contain internal bug, and about direct tries you should try: echo "$PROGRAM < input > output" | at now + 1 minute – Asain Kujovic Dec 04 '15 at 16:02
  • This doesn't give any output file for me when I tried it. I even tried replacing $PROGRAM with the actual path. – Christopher Dec 04 '15 at 16:18
  • 2
    @Christopher it's not supposed to give output. It should show a message like `job 3 at Fri Dec 4 18:21:00 2015` but that's printed to stderr, you won't see it if you're redirecting output. Also, please [edit] and tell us your operating system. Ideally, also try with something simple like `echo "date > file" | at now +1 minute` and check whether anything is printed to `file`. – terdon Dec 04 '15 at 16:22
  • @Christopher , nice test, i am confirming that ... echo "date > foo" | at now ; sleep 1 ; cat foo ... works well on all my linux comps. – Asain Kujovic Dec 04 '15 at 16:57
  • 1
    Related (and up-to-date for macOS Mojave): https://unix.stackexchange.com/questions/478823/making-at-work-on-macos – Kusalananda Oct 31 '18 at 17:15

1 Answers1

4

Seems that the at command doesn't work out of the box.

In my test, for example:

  • OS X, according to this SU answer needs:

      sudo launchctl load -w /System/Library/LaunchDaemons/com.apple.atrun.plist
    
  • raspbian needed:

      sudo apt-get install at (which will install and run atd, at daemon)
    
  • Arch Linux had at installed, but again needed the daemon to be started manually:

      sudo systemctl start atd
      sudo systemctl enable atd
    
Chris Combs
  • 103
  • 3
MetNP
  • 500
  • 4
  • 13