Tiny Core Linux
Tiny Core Base => TCB Q&A Forum => Topic started by: SwagmanXX on February 15, 2013, 08:51:28 AM
-
Hi,
I'm trying to run a startup-script for the app rdesktop and having problems. I searched the forum and faq and followed the steps as described:
1. tested rdesktop to my server --> entered following command in terminal console:
rdesktop -u <myusername> -d <mydomain> -p <mypassword> -k de -g 100% <serveripaddress>
--> rdesktop runs ok!
2. created a script file named rdes in folder "/home/tc/.X.d/" with following content:
#!/bin/sh
rdesktop -u <myusername> -d <mydomain> -p <mypassword> -k de -g 100% <serveripaddress>
3. made file rdes executable with entering command in terminal "~/.X.d/":
chmod 755 rdes
4. tested script file rdes in terminal "~/.X.d/":
sh rdes
-->script was executed and rdesktop was started.
So far so good. My problem is that my script rdes is not executed onboot. Means, when I turn on my computer TCL is booted but nothing else happens.
Thanks for any help & recommends.
Peter
-
Hi SwagmanXX
Try removing the:
#!/bin/sh
from the file.
-
Hi Rich,
removed first line in my script file. Unfortunately that didn't help.
When I start the script file in the terminal console with "sh rdes" it works fine.
-
Try adding some relevant logging to your script to ensure that it runs and what's going on when it does.
Could it be that it is running before the network is up?
If it doesn't run, maybe put that shebang back in if removing it didn't help.
-
Hi Lee,
Try adding some relevant logging to your script to ensure that it runs and what's going on when it does.
All I've set up by now is a result of searching the web and the threads of this forum. Unfortunately I've got no idea of writing scripts in linux an only know the basic console commands. Could you kindly give me a hint how to add logging to my script.
Could it be that it is running before the network is up?
How can I check that?
If it doesn't run, maybe put that shebang back in if removing it didn't help.
shebang is back in.
-
(
until ifconfig | grep -q "Bcast" ; do sleep 1 ; done
rdesktop -u <myusername> -d <mydomain> -p <mypassword> -k de -g 100% <serveripaddress>
) &
-
My understanding is that a scriptsin .X.d does not require to be made execuatble and adding #!/bin/sh is also not needed.
When .X.d/ is used here, it holds a single file which I name bootxapps. Permissions are rw-r--r--, and ownership is tc:staff (or whatever username is). All apps are started from this single file. Commands are added as if the have been issued at the command line and run in the background if required.
-
@ gerlad_clark:
Your script works fine. Thanks for your help.
-
Regarding logging - I was just thinking of something like
#!/bin/sh
echo "`date` - about to run rdesktop" >>/tmp/rdesktoplog.txt
ifconfig >>/tmp/rdesktoplog.txt
rdesktop -u <myusername> -d <mydomain> -p <mypassword> -k de -g 100% <serveripaddress>
echo "`date` - done." >>/tmp/rdesktoplog.txt
gerlad_clark's code for running it in the background with a delaying loop would actually solve the problem rather than just detecting it, if that is the problem.
I don't know if scripts in .X.d are sourced (don't need shebang) or called (do need shebang) but either way, the shebang is technically a comment so it doesn't hurt. The only time I omit it from a script is when I explicitly -don't- want it "called" - Usually when the script is an initialization file that sets variables to be used by the process that sources it.
-
Hi Lee
From .xsession:
[ -d ".X.d" ] && find ".X.d" -type f -print | while read F; do . "$F"; doneI think the period between do and "$F" means it is sourced.
On a side note regarding the previous two posts, it's spelled gerald_clark, not gerlad_clark. Use the copy and paste
functions if necessary.
-
I think the period between do and "$F" means it is sourced.
It does indeed.
it's spelled gerald_clark, not gerlad_clark.
Oops that was me that started that. Sorry gerla gerald_clark. :)
-
the shebang is technically a comment so it doesn't hurt.
IMHO at least when disassociated from very specific context that would be an overgeneralized statement, a shebang is an interpreter directive of functional essence - and accuracy of every detail which follows it is crucial.
-
Shebang is actually used by the program loader to direct it to load the specified binary and hand the file as an argument.
http://en.wikipedia.org/wiki/Shebang_(Unix)
-
That is what I meant by "interpreter directive".
-
offtopic
weird, that link has not got the last bracket as a part of url
http://en.wikipedia.org/wiki/Shebang_(Unix)
but I learn something everyday....the whole shebang