Toggle navigation
All Forums
Recent Posts
Sign In
Help using the "at" command in the terminal.
stedwick
Posted:
May 16, 2007 3:48PM
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
logout
^d
bash$
But it doesn't seem to work. Am I doing something wrong?
Thanks!
Philip
Comments
Reply 1 of 5
dacloo
Posts:
890
member
May 16, 2007 4:03PM
Hi! I guess using CRON would do the job.
http://wiki.ittoolbox.com/index.php/..._Unix_cron_job
Reply 2 of 5
1337_5l4xx0r
Posts:
1,558
member
May 17, 2007 1:53AM
I can't test this, but:
sleep 300 && logout &
Reply 3 of 5
domint
Posts:
2
member
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
stedwick
Posts:
78
member
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
lundy
Posts:
4,466
member
May 17, 2007 6:48PM
Type atq while waiting to see what is pending.
Sign In
or
Register
to comment.
Comments
http://wiki.ittoolbox.com/index.php/..._Unix_cron_job
sleep 300 && logout &
"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
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?