On Thu, 2009-09-03 at 00:54 +0200, SZABO Zsolt wrote:
> I am trying to write a script that shut down the (given set of) thin
> clients (TC). Therefore, I have installed openssh-server in ltsp-chroot,
> and I am able to ssh to a TC from the server and shut the TC down.
>
> So, what should such a script look like? Or is there a better, more
> appropriate solution for this task?
Google found a way to do it via inetd:
http://www.networkedmediatank.com/showthread.php?tid=8847
But neither sshd or inetd is installed on a stock ltsp client. However,
nc is! Scott B. posted a message to this list in 23 Aug 2007 to show how
it might be done with nc (Remote reboot in ltsp5 - Q & D). I can't find
his message in the archives, so here it is:
======================================================================
Ok, as promised:
First, create the following file in: /opt/ltsp/i386/usr/sbin/reboot.sh
---- snip below ----
#!/bin/sh
set -e
RBFILE=/etc/rebootpass
# If $RBFILE doesn't exist, exit
[ -f "${RBFILE}" ] || exit
PERM=$(stat -c "%a" "${RBFILE}")
[ "${PERM}" = "600" ] && RBPASS=$(cat "${RBFILE}") || exit
while :; do
PASS=$(nc -l -p 9200 | tr -d '\r\n')
[ "${PASS}" = "${RBPASS}" ] && /sbin/poweroff -fp
done
---- snip above ----
chmod 755 it, so it's executeable.
echo "foople" > /opt/ltsp/i386/etc/rebootpass
chmod 600 /opt/ltsp/i386/etc/rebootpass
Then, add the following line to /opt/ltsp/i386/etc/rc.local, above the
exit 0 line:
start-stop-daemon --start -b --exec /usr/sbin/reboot.sh
make sure rc.local gets run:
cd /opt/ltsp/i386/etc/rc2.d
mv K99rc.local S99rc.local
And boot your terminal.
Now:
echo "foople" | nc -q 0 <workstationip> 9200
should shutdown the box.
Quick, dirty, gets the job done.
Scott
------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now. http://p.sf.net/sfu/bobj-july
_____________________________________________________________________
Ltsp-discuss mailing list. To un-subscribe, or change prefs, goto:
https://lists.sourceforge.net/lists/listinfo/ltsp-discuss
For additional LTSP help, try #ltsp channel on irc.freenode.net