I wouldn't mind if it would automatically sleep after n minutes of inactivity in the evening and night, but during the day I'd like it if it wouldn't do that, to make sure it doesn't accidentally kill all my ssh sessions etc.

Obviously, the inverse is also acceptable: only enabling automatic sleep during set hours.

link|improve this question
feedback

1 Answer

up vote 1 down vote accepted

You didn't specify Gnome, KDE, or other, but if you're using Gnome and you extract the meat of this post then use it via a cron job, you should get what you want.

Essentially you're using the gnome-screensaver-command --poke to reset the idle timer. If you're not familiar with cron, take a look at this page. The cron line will depend a bit on your sleep timeout settings, but would be similar to (untested):

0 7-18 * * * marten gnome-screensaver-command --poke

...which would run the command on the hour between 7am and 6pm, as user 'marten'.

link|improve this answer
That's a nice trick, thanks! – Marten Veldthuis Oct 21 '11 at 19:14
feedback

Your Answer

 
or
required, but never shown

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