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.

This question already has an answer here:

I am running Xubuntu 13.04, I got in the habbit of closing my Acer Netbook and forgetting about it for a week+. I open it up to find it has still been running. How do I set it to shutdown after 15 minutes of inactivity? I don't want to set it to lid close because I often get up and close the lid so kids don't get at it. Also, due to the sometimes long stretches I go without touching it, I would like to make sure it is completely shutdown.

I'm sure I'm just missing some little check box. I've never had a setup that didn't shut itself down, or wasn't able to with a few click.

I already Googled the question for a bit and wasn't able to get the keywords right to get a relevant answer.

share|improve this question
add comment

marked as duplicate by Radu Rădeanu, raaz, Mitch, Alaa, Jorge Castro Sep 18 '13 at 18:15

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

1 Answer

Install xprintidle. This tool gives the idle time of a user.

sudo apt-get install xprintidle

Make a script autoshutdown.sh which checks for the idle time and instructs the computer to shutdown if idle for 30 minutes.

idle=`xprintidle`

if [ $idle -gt 1800000 ]; then

shutdown -h now

fi

Make a cronjob for this that checks from time to time if the system has been idle for too long and if it has been idle for a longer than 30 minutes it will shutdown. Note that the cronjob has to be made for the root user.

share|improve this answer
add comment

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