Re: Power off after a certain time of inactivity in Ubuntu (using the activiation of a screensaver to do it)

Rob Pearson <[email protected]>
Newsgroups gmane.org.user-groups.linux.dunedin.general
Message-ID <[email protected]>
That was quick and works well, many thanks.   I'd like the same 
~/.xscreensaver for all users on each computer, is this best done by 
copying the file across at each logon by customising /etc/profile, or is 
there a better way?  It'll probably get added to a central logon script 
later on.

On 22/05/13 21:38, Reece Arnott wrote:
> Rob was asking for a way to save power by turning off machines that 
> had been inactive for a certain number of hours in Ubuntu.
>
> The key thing to realise is that sensing inactivity is what 
> screensavers do so... sudo apt-get install xscreensaver if it isn't 
> already installed and do the following:
>
> 1) create an executable script file from the text file shown here: 
> https://gist.github.com/chrisyco/988104 (this is a wrapper to give you 
> the options to suspend, hibernate, restart, or shutdown). This is 
> optional if you are only going to ever want to shutdown.
>
> 2) Run xscreensaver-demo to create a ~/.xscreensaver prefs file if it 
> doesn't already exist.
>
> 3) Edit the ~/.xscreensaver file.
>
> The important thing is to insert the following line immediately under 
> the line that says "programs:       \":
> "Shutdown"     /absolute/path/to/power.sh shutdown \n\
>
> The other options below can either be set while you're editing the 
> file anyway, or via the GUI by running xscreensaver-demo:
> timeout:    2:00:00 # This is the time of inactivity to wait hh:mm:ss
> mode:        one # So only one screensaver is run. Note that if you 
> ever set this back to cycle through random screensavers you should 
> take out the above Shutdown screensaver :-)
> selected:    0 #which screensaver is run, if the shutdown script is 
> the first one listed under programs then it will be screensaver 0
>
> If you are *only* going to shutdown you don't need to power.sh script, 
> instead you can replace the reference to it above with the following 
> line:
> "Shutdown" dbus-send --system --print-reply 
> --dest=org.freedesktop.ConsoleKit /org/freedesktop/ConsoleKit/Manager 
> org.freedesktop.ConsoleKit.Manager.Stop \n\
>
> (I have tested this on Ubuntu 13.04 and it works. There may be minor 
> variations in the older versions so YMMV)
>


_______________________________________________
DunLUG mailing list
[email protected]
http://lists.ethernal.org/listinfo/dunlug
DunLUG Wiki - http://dunlug.kallisti.net.nz/
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.