General TC > Programming & Scripting - Unofficial
reboot local machine when rdesktop logs off
get2guy:
Hi All
I configure a machine to dual boot win7+tiny core
Tiny core is starting rdesktop with credentials to specific IP (works well since user & pass are per computer not user)
I don't know how I can make tiny core to reboot the local machine when the session ends. the goal is to go back to the bootloader menu.
Can someone help?
changes i made:
Created the file /home/tc/myrdesktop
-------------------------------------------------
#!/bin/sh
# myrdesktop
while true
do
rdesktop -f -u XXXX -p XXXX 10.10.10.10
done
-------------------------------------------------
Edited the file /home/tc/.xsession (added the last 2 lines)
-------------------------------------------------
Xvesa -br -screen 1024x768x32 -shadow -2button -mouse /dev/input/mice,5 -nolisten tcp -I>/dev/null 2>&1 & export XPID=$!
waitforX || ! echo faild in waitforX || exit
"$DESKTOP" 2>/tmp/wm_errors &
export WM_PID=$!
[ -x $HOME/.setbackground ] && $HOME/.setbackground
[ -x $HOME/.mouse_config ] && $HOME/.mouse_config &
[ $(which "$ICONS".sh) ] && ${ICONS}.sh &
[ -d "$HOME/.X.d" ] && find "$HOME/.X.d" -type f -print l while read F; do . "$F"; &
$HOME/autostart &
done
-------------------------------------------------------
Created the file /home/tc/.X.d/myrdesktop.sh
-------------------------------------------------------
#!/bin/sh
# myrdesktop
while true
do
rdesktop -f -u XXXX -p XXXX 10.10.10.10
done
-------------------------------------------------------
Gave the user poweroff and reboot privilege
-------------------------------------------------------
chmod u+s /sbin/poweroff
chmod u+s /sbin/reboot
-------------------------------------------------------
Misalf:
Déjà vu...
Im not too sure but your ~/.xsession looks kinda bad. I think it will execute $HOME/autostart as many times as there is a file found in $HOME/.X.d and won't execute $HOME/autostart at all if there is nothing in $HOME/.X.d .
I'd suggest you either change it to this...
--- Code: ---Xvesa -br -screen 1024x768x32 -shadow -2button -mouse /dev/input/mice,5 -nolisten tcp -I>/dev/null 2>&1 & export XPID=$!
waitforX || ! echo faild in waitforX || exit
"$DESKTOP" 2>/tmp/wm_errors &
export WM_PID=$!
[ -x $HOME/.setbackground ] && $HOME/.setbackground
[ -x $HOME/.mouse_config ] && $HOME/.mouse_config &
[ $(which "$ICONS".sh) ] && ${ICONS}.sh &
[ -d "$HOME/.X.d" ] && find "$HOME/.X.d" -type f -print l while read F; do . "$F"; done
[ -x $HOME/autostart ] && $HOME/autostart
--- End code ---
... or save your autostart script in ~/.local/bin and let it be run from ~/.X.d by placing a file there (any file name; non-executable) that has only this content:
--- Code: ---autostart
--- End code ---
get2guy:
Hi Misalf and thanks for your reply.
I thinks you got my question wrong.
The scripts works well, it start automatically on startup and logs me in 10.10.10.10. the issue is at the logoff from the terminal server.
Currently when i logoff the script runs again.
I wish it will reboot tiny core in order to get the bootloader screnn (win 7 or the default tiny core OS)
maybe .bash_logout script should do the trick but i cant find such file in tiny core.
Can someone refer me to the location? or replacement file in tiny core OS?
Rich:
Hi get2guy
I think what you are looking for is something similar to this:
--- Code: ---exitcheck.sh
sudo reboot
--- End code ---
Lee:
--- Quote ---
--- Code: ---#!/bin/sh
# myrdesktop
while true
do
rdesktop -f -u XXXX -p XXXX 10.10.10.10
done
--- End code ---
...
Currently when i logoff the script runs again.
I wish it will reboot tiny core in order to get the bootloader screnn (win 7 or the default tiny core OS)
--- End quote ---
Do you mean that, when you log out of the rdesktop session, rdesktop starts over again?
If so, you might change the script to something like this:
--- Code: ---#!/bin/sh
# myrdesktop
rdesktop -f -u XXXX -p XXXX 10.10.10.10 ; sudo reboot
--- End code ---
Navigation
[0] Message Index
[#] Next page
Go to full version