Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
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!
I'll hazzard a guess and say that you'll have to write a wrapper
in e.g., perl, around this. Linux' rdesktop program doesn't know
what an rdp file is (is meant to be). A wrapper could parse the
values out of the rdp file and pass them as command-line parameters
to rdesktop (some of them, anyway; not sure rdesktop can make
sense of all of them).
#!/usr/bin/env perl
#
use warnings;
use strict;
open RDP, "./rdp_file";
my $vals = {};
while( <RDP> ) {
my @line = split ":", $_;
my ( $label, $type, $value ) = @line;
# Put something in here if you want to double check that
# $value is of type $type. Look at ref()
$vals->{ $label } = $value;
}
close RDP;
# Here you interact as per the convention
# print $ref->{"name of the arg you want"}
print $vals->{"username"};
That one there is reading from a file called 'rdp_file' and attaching it to the file handle 'RDP'.
It all depends on how the script is going to react with the dynamic launch.rdp file; or at least how it gets a copy of it. You could add the functionality for this to grab a copy of this over http (http://search.cpan.org/~gaas/libwww-...836/lib/LWP.pm or even better http://search.cpan.org/~gaas/libwww-.../LWP/Simple.pm) and then instead of reading from a file splitting it by line into an array and doing the same operation
I guess I'm hoping to do this as simplistic as possible. If I could just get the script to look through the launch.rdp file, pull out the address, and then add it to the rdesktop command that would be perfect.
Well if the launch.rdp is dynamic, you want the script to get the file, pick it out, and start up. Give me a few mins to start a similar environment on my test rig and I'll give you something you can use
#!/usr/bin/env perl
#
use warnings;
use strict;
use LWP::Simple;
my $rdp_file = get( "http://localhost/rdp_file" );
my @rdp_arr = split "\n", $rdp_file;
my $vals = {};
foreach ( @rdp_arr ) {
my @line = split ":", $_;
my ( $label, $type, $value ) = @line;
$vals->{ $label } = $value;
}
# Here you interact as per the convention
# print $ref->{"name of the arg you want"}
print $vals->{"username"};
# You must uncomment the line below and fill out args in that
#system( "rdesktop " );
Just change the get() call to wherever your users nav to when they want the dynamic file.
Thanks again James. Can you take me through what this script is doing? Also I copied it down, but I am getting an error when executing. It says "Use of uninitialized value in print at line 23".
PS - If it helps the line that I need to pull out of the rdp file is "full address:s:172.16.0.117". Thank you again.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.