Help using the "at" command in the terminal.
May 16, 2007 3:48PM
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
May 16, 2007 4:03PM
Hi! I guess using CRON would do the job.
Reply 2 of 5
May 17, 2007 1:53AM
I can't test this, but:
sleep 300 && logout &
Reply 3 of 5
May 17, 2007 7:51AM
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/com.apple.atrun.plist"
So it seems you need to enable that service if you want to use the at command.
Hope this helps
Reply 4 of 5
May 17, 2007 9:26AM
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
May 17, 2007 6:48PM
Type atq while waiting to see what is pending.