[K12OSN] Auto shutdown certain clients

Jeff Siddall news at siddall.name
Fri Apr 16 00:21:27 UTC 2010

On 04/15/2010 04:43 PM, Jeff Siddall wrote:
> On 04/14/2010 08:26 PM, Barry Cisna wrote:
>> Jeff,
>> Ask and ye shall receive,,,:-)
>> No reason this shouldn't work with a little elbow grease....
>>  http://autopoweroff.sourceforge.net/
>> Barry
> Interesting.  If I set the idle time very high this might work.
> Now I need to figure out how to run this selectively on certain TCs.
> Not having given up on my original idea, I also tried SUID on
> /sbin/shutdown but still no-go running it from ltsp-localapps :(


Turns out the SUID thing does work -- I just typo'd my script when I
tested it that way.  That being said the man page says not to user SUID
so what I ended up doing is this:

1. Install sudo in the chroot
2. Remove this line from /etc/sudoers since ltsp-localapps launched
things do not have a TTY:

Defaults    requiretty

3. Add this line to /etc/sudoers:

%users  ALL=(ALL)       NOPASSWD: ALL

4. Create a script somewhere accessible on the client (ex:
~/auto-shutdown.sh) which contains something like this:

ltsp-localapps sudo /sbin/shutdown -P +720

5. Create a desktop file in the autostart directory for the desired
user(s) (ex: ~/.config/autostart/auto-shutdown.desktop) which contains
something like this:

[Desktop Entry]
Comment=automatically power off thin client

Note:This step works for XFCE.  Not sure if all other desktop
environments also work like this.

6. Reboot, login (or autologin in my case) and wait for shutdown!


More information about the K12OSN mailing list