A common problem with ltsp thin clients seems to be getting them to shutdown automatically for the night. There are various methods that include shutdown commands run from cron and daemons listening for remote commands. Both of the methods do work, but purely time based solutions can be annoying for the users. Having the thin client shutdown while writing an essay is really not optimal user experience.
After trying various approaches it seems like Autopoweroff is a good solution for the problem. It allows one to define time based shutdown rules, but also makes sure that no-one is using the thin client when it is shut down. Also other rules can be used, e.g. to check if a remote host is still available. One can define daytime hours when the thin client won’t be shut down even if it is idle. Outside the daytime hours the thin clients are turned off if they are not used for specified number of minutes. This closes also open sessions that are not being used which is useful in schools where people forget their sessions open and invite pranksters.
Here’s a quick howto to install Autopoweroff in Ubuntu based ltsp5 systems. The package is installed in the chroot and it is started automatically when the thin client boots. This has been tested with Ubuntu 8.04 and the newest 9.10 Karmic beta.
Deb file for Autopoweroff can be downloaded from SourceForge. After downloading the deb-file it should be copied to /opt/ltsp/i386
so that it can be installed. autopoweroff package has a dependency on gksu so it needs to be installed before installing autopoweroff.
sudo cp autopoweroff-2.9.1-1.noarch.deb /opt/ltsp/i386/
Install the package and its dependencies:
sudo chroot /opt/ltsp/i386 apt-get install gksu dpkg -i autopoweroff-2.9.1-1.noarch.deb
To configure Autopoweroff one can modify directly the configuration file in /opt/ltsp/i386/etc/autopoweroffd.conf:
[NO_SHUTDOWN_TIME_RANGE] StartHour=09 EndHour=17 [TIMEOUTS] StartupDelay=30 IdleTime=30 [DEPENDANTS] Hosts=
After updating the image the thin clients should turn off automatically after 5pm if they have not been used for 30 minutes.
To configure shutdown settings individually for every thin client through lts.conf, the init.d script can be modified. An example can be downloaded here. The file should be placed in /opt/ltsp/i386/etc/init.d/autopoweroff
.
Now shutdown settings can be configured in lts.conf:
[Default] AUTOPOWEROFF = Y AUTOPOWEROFF_START = 09 AUTOPOWEROFF_END = 17 AUTOPOWEROFF_STARTUP_DELAY = 30 AUTOPOWEROFF_IDLE_TIME = 30
The meaning of the parameters is:
- AUTOPOWEROFF – autopoweroffd enabled
- AUTOPOWEROFF_START – daytime start hour (24 hour clock)
- AUTOPOWEROFF_END – daytime end hour (24 hour clock), the thin client won’t be shutdown between start and end hours
- AUTOPOWEROFF_STARTUP_DELAY – after booting the thin client, it won’t be shut down in specified number of minutes even if no-one is using it
- AUTOPOWEROFF_IDLE_TIME – how many minutes the thin client’s mouse and keyboard need to be idle before it is shut down (outside daytime hours)
Next step would be to do better integration and get everything installable using apt-get. Ideas on this are welcome!
Veli-Matti Lintu
Hi,
Very useful article, however I am heaving a problem installing gksu onto chroot for ltsp. Therefore I can not install autopoweroff.
It is a problem with dependencies of gksu.
apt-get -f install gksu do not help either.
Can you please suggest a solution.
Kiitos paljon/Many thanks,
Csaba
Hi
I used Autopoweroff successfully in 8.04 but now in 10.04 it doesn’t work. Have you noticed anything alike?
Harri