I have the need for teachers to fill in electronic registers in remote areas, and they need to be able to do it fast and with the least fuss necessary. To accomplish this I have set up netbooks with a "vanilla" Debian 6 install with nothing on it other than rdesktop. The netbook logs in automatically (via /etc/inittab) and then I use the .profile the .bashrc files in the user's home directory to relaunch networking (to fix a dhcp bug), launch startx for window server, and then launch rdesktop into a terminal server to take the register. This works flawlsessly, and the teacher is presented with their register in less than 30 seconds.
What I would like to happen is that when they close rdesktop (log out of the terminal server) the laptop shuts down, but have so far failed. I had originally tried just adding the shutdown command to the next line of the script, but for some unexplainable reason the script appears to run out of order and the machine is shutting down before rdesktop runs. I think this is because rdesktop is "forking'. Is there a way I can wait for rdesktop to quit before the rest of the script runs?
I have already tried: sleep before the shutdown wait before the shutdown
I know how I could do this in visual basic / vbscript / batch file but I am very new to linux and am starting to think I am missing the obvious or being stupid!
My files are as follows:
/home/user/.profile: sudo dhclient startx -- :1 /home/user/.bashrc: rdesktop -u "" -k en-gb -f servername
(The lack of username is intentional as it causes the terminal server to not pre-fill the username for login with the linux username of the netbook)