Results 1 to 10 of 13
I am looking to setup some computers as thinclients to connect to my MS Terminal Servers. We have a homebrew application that configures RDP sessions. A user logs into a ...
- 05-29-2010 #1Just Joined!
- Join Date
- May 2010
- Posts
- 12
[SOLVED] RDP Capability Needed
I am looking to setup some computers as thinclients to connect to my MS Terminal Servers. We have a homebrew application that configures RDP sessions. A user logs into a webpage that dynamically generates a "launch.rdp" file. This file is generated to balance the load between servers.
What I'd like to do is configure an image to boot up into Mozilla. When the user goes to the webpage, I'd like the launch.rdp file to open up in a terminal server session.
I've tried with rdesktop and tsclient, but unfortunately neither would work with a "rdp" file. Any help or suggestions are appreciated. Thanks!
- 05-30-2010 #2Linux User
- Join Date
- Jan 2005
- Location
- Saint Paul, MN
- Posts
- 262
The question is what is in the file, "launch.rdp"? It might be possible to use the data within it by a script that launches one of the linux clients such as rdesktop or tsclient (or grdesktop).
- 05-30-2010 #3Just Joined!
- Join Date
- May 2010
- Posts
- 12
The launch.rdp file contains this:
The reason I'd like to get something that can open .rdp files is so that I don't need to change anything server side. From what I've gathered rdesktop and tsclient aren't able to directly open an rdp file.Code:screen mode id:i:2 desktopwidth:i:1280 desktopheight:i:1024 session bpp:i:24 winposstr:s:2,3,0,0,800,600 full address:s:172.16.0.117 compression:i:1 keyboardhook:i:2 audiomode:i:0 redirectdrives:i:1 redirectprinters:i:1 redirectcomports:i:0 redirectsmartcards:i:1 displayconnectionbar:i:1 autoreconnection enabled:i:1 username:s:User domain:s:America alternate shell:s: shell working directory:s: disable wallpaper:i:0 disable full window drag:i:0 disable menu anims:i:0 disable themes:i:0 disable cursor setting:i:0 bitmapcachepersistenable:i:1
- 05-31-2010 #4Linux User
- Join Date
- Jan 2005
- Location
- Saint Paul, MN
- Posts
- 262
Here is a sample script that picks some of the fields from the file and then calls "rdesktop" with the selected options. I assume that with an example and the man page for rdesktop, other options can be processesd and passed to rdesktop.
The script is run with the "*.rdp" file as the first argument (I assumed that it was downloaded prior to the script running. If needed, wget might be able to ontain the "*.rdp" file.
Disclaimer: This script has not been tested. I will help if needed via information passed via the forum. I do not get the "*.rdp" or have a windows machine to connect to via "remote desktop" at this point in time to create a fake "*.rdp" file from the example.
Code:#!/bin/bash # RDESKTOP="/usr/bin/rdesktop" the_raw_data=($(cat ${1})) Width=800 height=600 depth=24 compression=0 host="" user="" domain="" use_shell="" use_dir="" for f in "${the_raw_data[@]}"; do echo $f; done case "${f}" in screen\ mode\ id*) unhandled="${f##*:} ;; desktopwidth*) Width="${f##*:}" ;; # -g WxH desktopheight*) height="${f##*:}" ;; # -g WxH session\ bpp*) depth=" -a ${f##*:}" ;; winposstr*) unhandled="${f##*:} ;; full\ address*) host=" -n ${f##*:}" ;; compression*) compression="${f##*:}" ;; # -z keyboardhook*) unhandled="${f##*:} ;; audiomode*) unhandled="${f##*:} ;; redirectdrives*) unhandled="${f##*:} ;; redirectprinters*) unhandled="${f##*:} ;; redirectcomports*) unhandled="${f##*:} ;; redirectsmartcards*) unhandled="${f##*:} ;; displayconnectionbar*) unhandled="${f##*:} ;; autoreconnection\ enabled*) unhandled="${f##*:} ;; username*) user=" -u ${f##*:}" ;; domain*) domain=" -d ${f##*:}" ;; alternate\ shell*) use_shell=" -s ${f##*:}" ;; shell\ working\ directory*) use_dir=" -c ${f##*:}" ;; disable\ wallpaper*) unhandled="${f##*:} ;; disable\ full\ window\ drag*) unhandled="${f##*:} ;; disable\ menu\ anims*) unhandled="${f##*:} ;; disable\ themes*) unhandled="${f##*:} ;; disable\ cursor\ setting*) unhandled="${f##*:} ;; bitmapcachepersistenable*) unhandled="${f##*:} ;; esac done geometry=" -g ${Width}x${height}" [ ${compression} -gt 0 ] && compression=" -z" || compression="" ${RDESKTOP} ${geometry}${depth}${compression}${host}${user}${domain}${use_shell}${use_dir} &
Note if you include a "-C" option 32-bit might be available on a normal 24-bit but non-focused window my look psychedelic if it does use 32-bit for a window and 24-bit for the others.
- 05-31-2010 #5Just Joined!
- Join Date
- May 2010
- Posts
- 12
Hey Alf, I like where you're going. Is there a way to run this to only pull out the host address and parse that into rdesktop command?
- 05-31-2010 #6Linux User
- Join Date
- Jan 2005
- Location
- Saint Paul, MN
- Posts
- 262
Of couse, I was pulling host, user, domain, color depth, compression, shell, directory. only use the host that was extractied.
Change theto be${RDESKTOP} ${geometry}${depth}${compression}${host}${user}${d omain}${use_shell}${use_dir} &
Also the other stuff in the case can be removed as well.Code:${RDESKTOP}${host} &
- 05-31-2010 #7Just Joined!
- Join Date
- May 2010
- Posts
- 12
I'm not sure if it's extracting the host correctly. When I run the script it outputs the entire contents of launch.rdp, and then attempts to launch rdesktop with no switches.
Here's what I have in the script:
Thanks again for the help.Code:#!/bin/sh RDESKTOP="/usr/bin/rdesktop" the_raw_data=($(cat ${1})) resolution=1024x768 host="" for f in "${the_raw_data[@]}"; do echo $f; done case "${f}" in full\ address*) host=" -n $f{##*:}" ;; esac ${RDESKTOP} -d domain -g ${resolution} ${host}
Additionally if it helps, here's what the full address line looks like in the rdp file:
Code:full address:s:172.16.0.117
- 06-01-2010 #8Linux User
- Join Date
- Jan 2005
- Location
- Saint Paul, MN
- Posts
- 262
My error ---
The problem is that I did not handle the spaces in the keywords and I messed up the for loop when I copied at the begining. (I had two loops the first dumped the data present and the second processed the data. I included the first and skiped the second.
The second error was I forgot to include the [quote]IFS=$'\n'[\quote] line as well. This makes the seperator for the array that I am building to be the new-line rather than white-space. I also added a save and restore the value for IFS.
The problem is that I did not handle the spaces in the keywords and I messed up the for loop when I copied at the beginning. (I had two loops the first dumped the data present and the second processed the data. I included the first and skipped the second.Code:#!/bin/sh RDESKTOP="/usr/bin/rdesktop" remember_IFS="${IFS}" IFS=$'\n' the_raw_data=($(cat "${1}")) IFS="${remember_IFS}" resolution=1024x768 host="" for f in "${the_raw_data[@]}"; do case "${f}" in full\ address*) host=" -n $f{##*:}" ;; esac done ${RDESKTOP} -d domain -g ${resolution} ${host}
Example run of the corrected script with an "echo of the command" to be run is show below while using your posted data for the "launch.rdp" is after the re-posting of the corrected original script.
For those that would like the working copy of the original script it follows.
Results with the posted "launch.rdp" and the line:Code:#!/bin/sh # # To run: # the_name_of_this_script launch.rdp # RDESKTOP="/usr/bin/rdesktop" { IFS=$'\n' the_raw_data=($(cat "${1}")) } host="" Width=800 height=600 depth=24 compression=0 host="" user="" domain="" use_shell="" use_dir="" for f in "${the_raw_data[@]}"; do case "${f}" in screen\ mode\ id*) unhandled="${f##*:}" ;; desktopwidth*) Width="${f##*:}" ;; desktopheight*) height="${f##*:}" ;; session\ bpp*) depth=" -a ${f##*:}" ;; winposstr*) unhandled="${f##*:}" ;; full\ address*) host=" -n ${f##*:}" ;; compression*) compression="${f##*:}" ;; keyboardhook*) unhandled="${f##*:}" ;; audiomode*) unhandled="${f##*:}" ;; redirectdrives*) unhandled="${f##*:}" ;; redirectprinters*) unhandled="${f##*:}" ;; redirectcomports*) unhandled="${f##*:}" ;; redirectsmartcards*) unhandled="${f##*:}" ;; displayconnectionbar*) unhandled="${f##*:}" ;; autoreconnection\ enabled*) unhandled="${f##*:}" ;; username*) user=" -u ${f##*:}" ;; domain*) domain=" -d ${f##*:}" ;; alternate\ shell*) use_shell=" -s ${f##*:}" ;; shell\ working\ directory*) use_dir=" -c ${f##*:}" ;; disable\ wallpaper*) unhandled="${f##*:}" ;; disable\ full\ window\ drag*) unhandled="${f##*:}" ;; disable\ menu\ anims*) unhandled="${f##*:}" ;; disable\ themes*) unhandled="${f##*:}" ;; disable\ cursor\ setting*) unhandled="${f##*:}" ;; bitmapcachepersistenable*) unhandled="${f##*:}" ;; esac done geometry=" -g ${Width}x${height}" [ ${compression} -gt 0 ] && compression=" -z" || compression="" ${RDESKTOP}${geometry}${depth}${compression}${host}${user}${domain}${use_shell}${use_dir} &
becoming${RDESKTOP}${geometry}${depth}${compression}${host }${user}${domain}${use_shell}${use_dir} &echo ${RDESKTOP}${geometry}${depth}${compression}${host }${user}${domain}${use_shell}${use_dir} &Code:bash$ /tmp/my_rdesktop /tmp/launch.rdp /usr/bin/rdesktop -g 1280x1024 -a 24 -z -n 172.16.0.117 -u User -d America -s -c bash$
- 06-01-2010 #9Just Joined!
- Join Date
- May 2010
- Posts
- 12
This is EXACTLY what I needed!! Thank you so much for the time and effort you put into this Alf. It is very much appreciated!!
- 06-02-2010 #10Linux User
- Join Date
- Jan 2005
- Location
- Saint Paul, MN
- Posts
- 262
Your welcome. Glad that I could help.
Wrapper scripts are much easier to create in Unix/Linux than in Windows. There a lot to be said about having a robust scripting language.
I have a wrapper script for "shoutcast" within streamtuner because they changed to supply multiple locations in a file from what was a location and worked nice with mplayer.
I also tend to run everything from the command line. In the old days (1984-KDE release) people wrote applications that were GUI to run in background but since the KDE-release they are not being written this way. By writting wrapper scripts I have been able to use the command WWW to lauch my browser which started out being Mosaic and is currently Firefox with a simple command that then runs the tool of the day for that application.
I even have wrappers for OpenOffice applications, almost every thing that I used. However, the applications vim, vimdiff, gvim, and gvimdiff have never had a wrapper script. Back in 1985-1987 I used emacs but a vi (or a derived editor) is the only editor that is part of the Unix specification and in 1987 I had to learn vi and never left it (I vi preference are: gvim, elvis, vim, and then normal vi).


