Tiny Core Linux
General TC => Programming & Scripting - Unofficial => Topic started by: get2guy on November 26, 2014, 05:04:21 AM
-
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
-------------------------------------------------------
-
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...
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
... 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:
autostart
-
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?
-
Hi get2guy
I think what you are looking for is something similar to this:
exitcheck.sh
sudo reboot
-
#!/bin/sh
# myrdesktop
while true
do
rdesktop -f -u XXXX -p XXXX 10.10.10.10
done
...
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)
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:
#!/bin/sh
# myrdesktop
rdesktop -f -u XXXX -p XXXX 10.10.10.10 ; sudo reboot
-
I was about to suggest the same and tested it with
conky ; sudo reboot
in a file from my ~/.X.d folder but it rebooted right after starting X.
Was kinda messy to set it back to normal. (:
-
I was about to suggest the same and tested it with
conky ; sudo reboot
in a file from my ~/.X.d folder but it rebooted right after starting X.
Was kinda messy to set it back to normal. (:
Testing is for sissies. :)
I'll admit I didn't test that, as it seemed so simple. Could it be that conky failed to run, or ran in the background? Perhaps using " && " instead of " ; " to ensure that the reboot only happens if the previous command succeeds... or, failing that, some actual testing on my part would be inorder. Unfortunately, I'm sitting at my wife's PC right at the moment and it would be bad form to chance inadvertently rebooting it... -she- can actually reach me.
-
Maybe conky behaves differently or I just lied about the exact command.. unknowingly. q:
My shell script knowledge is low but I get what ; usually means, however && would only executes the following command if the previous command has ended successfully (returns true or zero), right?
Might those sybols be treated in another way when "sourced" as when executed "directly" (not sure if that makes any sense)?
-
Would this work?
#!/bin/sh
# myrdesktop
while true
do
rdesktop -f -u XXXX -p XXXX 10.10.10.10
done
reboot
-
No. That while loop runs forever and anything after "done" has no chance to get executed.
I suggest you try what Lee said.
-
Then maybe something like this example,
http://www.freeos.com/guides/lsst/ch03sec07.html
but use
while [ $i -le 2 ]
Once it finishes the loop would it not go onto the next command in the script, which could then be reboot(?).
-
What is the point? He doesn't want it to loop, and without some manipulation of i, that loop won't terminate either.