Help using the "at" command in the terminal.

in macOS edited January 2014
If I'm ssh'ed into my computer and I want to make it automatically log me out in 5 minutes, shouldn't I be able to do

bash$ at now + 5 minutes




But it doesn't seem to work. Am I doing something wrong?




  • Reply 1 of 5
    dacloodacloo Posts: 890member
    Hi! I guess using CRON would do the job.
  • Reply 2 of 5
    1337_5l4xx0r1337_5l4xx0r Posts: 1,558member
    I can't test this, but:

    sleep 300 && logout &
  • Reply 3 of 5
    domintdomint Posts: 2member
    The at command is disable in OS X. If you bring up the man page for the at command it says:

    "at, batch, atq, atrm are all disabled by default on Mac OS X. Each of

    these commands depend on the execution of atrun(8) which has been dis-

    abled due to power management concerns. Those who would like to use

    these commands, must first (as root) re-enable atrun by running:

    launchctl load -w /System/Library/LaunchDaemons/"

    So it seems you need to enable that service if you want to use the at command.

    Hope this helps
  • Reply 4 of 5
    stedwickstedwick Posts: 78member
    I'm not all that knowledgeable about the terminal, but nothing is working...

    Even "sleep 3 && exit &" and "sleep 3 && logout &" don't work. Interestingly, when I do "sleep 3 && logout &" I get this

    -bash: line 165: logout: not login shell: use `exit'

    which is why I tried "sleep 3 && exit &" but still nothing works. Now, if I manually type "logout" or "exit" it logs me out no problem.

    Any thoughts? I'm using Putty on Windows to reach my iMac at home, if that matters.

    Oh, and "sleep 3 && echo hi &" does print hi, so sleep is working...but why isn't logout working?
  • Reply 5 of 5
    lundylundy Posts: 4,466member
    Type atq while waiting to see what is pending.
Sign In or Register to comment.