Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I know how to suspend after a delay by using:

echo 'pmi action suspend' | at now + 1 minutes

However, that only seems to work as long as I keep the console window open. Am I correct in assuming that the at commands are cleared when I close the console?

This is an issue as I want to be able to log in to my computer via SSH, send the suspend command, then log out before it happens. Suspending immediately tends to freeze my local console window, which is inconvenient. Is there a way to send a delayed suspend command without it being cleared when I log out?

share|improve this question

1 Answer 1

up vote 1 down vote accepted

You can use screen and detach from the screen session. After that you can exit the ssh session and the command will continue to run.

screen (press [Return} to end the help screen)

in the new screen, you type your command and press ctrl-a d to detach from the session

then you can close your ssh terminal.

If you want to reconnect to the screen session, you can type screen -r.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.