Skip to content

Instantly share code, notes, and snippets.

@scottious
Created September 14, 2015 03:20
Show Gist options
  • Save scottious/97d5abeeceb94ce88d53 to your computer and use it in GitHub Desktop.
Save scottious/97d5abeeceb94ce88d53 to your computer and use it in GitHub Desktop.
Working while sleeping - using "at" command on osx

*Good for yosemite or snow leopard

  1. Edit the /System/Library/LaunchDaemons/com.apple.atrun.plist, change the disabled child node from true -> false.

  2. Unload the current /System/Library/LaunchDaemons/com.apple.atrun.plist with:

    sudo launchctl unload -F /System/Library/LaunchDaemons/com.apple.atrun.plist

Then load the edited version

sudo launchctl load -F /System/Library/LaunchDaemons/com.apple.atrun.plist
  1. Test that it works with:

    echo blah | at now+1

  2. In case the echo fails for a different reason, you should be able to at least see the queue get cleared with:

    atq

  3. Check your current sleep timeout

    sudo systemsetup -getcomputersleep

  4. Turn off system sleep

    sudo systemsetup -setcomputersleep Never

  5. Schedule your at command e.g.

    at 4:30am tomorrow cd ~/myapps/autocatinator script/begin_cat_feeding script/unlock_cat_door ^D

  6. If using a laptop ensure you're plugged into power :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment