Log into server (with rdesktop) on bootup?

Booting, installing, newbie
Message
Author
plockery
Posts: 26
Joined: Mon 13 Jun 2005, 09:28

Log into server (with rdesktop) on bootup?

#1 Post by plockery »

How do I get puppy to run rdesktop when it boots up so as to log in to a server automatically?

I know the rdesktop parameters.

What I need to know is where I put the command so that it runs.

I have tried putting the following command in /root/.xinitrc (before and after "exec fvwm95") and /root/rc.d/rc.local but to no avail.

rdesktop -u test -p mypassword -a 16 -f myserveripaddress

I simply come up with the normal fvwm95 screen (no error that I can see).

The network itself is up and running and if I go to rxvt and type this rdesktop command in manually it works fine.

But I just want this terminal at work to bootup and connect to our windows terminal server automatically.

Can anyone help?

User avatar
Ian
Official Dog Handler
Posts: 1234
Joined: Wed 04 May 2005, 12:00
Location: Queensland

#2 Post by Ian »

You may have to provide the full path for the command.

plockery
Posts: 26
Joined: Mon 13 Jun 2005, 09:28

#3 Post by plockery »

Have tried that.

/usr/local/bin/rdesktop -u test -a 16 -f myserveripaddress

Any other clues?

Guest

#4 Post by Guest »

This is just a quick off the top of the head hack, use a text editor and start with #!/bin/sh, on the next line enter the full path for the command, save it as rmtdsk and chmod a+x it.

Put an entry in rc.local like, exec /the path to rmtdsk, and see if it works.

I'm sorry I can't be more helpful at the moment but I am a bit busy.

If this doesn't work I'l try to spend a bit more time on it.

plockery
Posts: 26
Joined: Mon 13 Jun 2005, 09:28

#5 Post by plockery »

Thanks guest.

But no. Unfortunately, that does not work either.

If I click on rc.local after boot-up it executes perfectly either way - through direct command or the exec rmtdsk option.

But for some reason it won't do it at boot-up.

It is just this command because I also have put a "modprobe sb" in rc.local to get my soundcard working and it seems to execute fine.

So not sure why rdesktop does not.

Any further ideas?

User avatar
Ian
Official Dog Handler
Posts: 1234
Joined: Wed 04 May 2005, 12:00
Location: Queensland

#6 Post by Ian »

You could try putting it in /etc/profiles at the end after the exec xwin entry.

plockery
Posts: 26
Joined: Mon 13 Jun 2005, 09:28

#7 Post by plockery »

Thanks Ian

But still no luck. It seems crazy when you can run it perfectly well after boot-up.

I presume you meant to put it after "exec xwin" within the "if fi" argument in /etc/profile.

My rmtdsk looks like this:

!bin.sh
/usr/local/bin/rdesktop -u test -p testpassword -a 16 -f myserveripaddress

Like I say click on rmtdsk itself or run exec /root/rmtdsk and it goes straight in.

Could it not be finding the server yet?
Is there a log file where it might tells us what is going on?

Peter

GuestToo
Puppy Master
Posts: 4083
Joined: Wed 04 May 2005, 18:11

#8 Post by GuestToo »

do not put it after exec xwin ... it will never execute ... exec xwin transfers to xwin, and never comes back

you can try it somewhere before exec xwin,
after export SHSQL_DB would be a good place
just before exec xwin might be better

there are things that are setup in /etc/profile that are not setup yet when rc.local runs ... for example, PATH and LD_LIBRARY_PATH, so if the program will not run from rc.local but will run after /etc/profile has executed, it is not surprising

User avatar
Ian
Official Dog Handler
Posts: 1234
Joined: Wed 04 May 2005, 12:00
Location: Queensland

#9 Post by Ian »

Thanks for the input GuestToo.

plockery
Posts: 26
Joined: Mon 13 Jun 2005, 09:28

#10 Post by plockery »

Thanks GuestToo.

But this does not work either.

If I put "exec /root/rmtdsk" in before "exec xwin" in /etc/ profile it just stops with the error "failed to open display" and then waits for me to enter xwin manually to boot-up.

If I put the command "rdesktop [and appropraite options]" I get the same message but it then ignores the command and then boots xwin anyway.

It seems to be clear that for whatever reason rdesktop cannot execute properly until a window manager opens.

What I need therefore is the equivalent of windows "startup" feature in its start menu which can run programs after the gui is loaded.

Is there an equivalent in puppy?
That is, is it possible to automatically start a program after xwin loads?

Peter

User avatar
Lobster
Official Crustacean
Posts: 15522
Joined: Wed 04 May 2005, 06:06
Location: Paradox Realm
Contact:

Run at startup

#11 Post by Lobster »

/root/.etc/rc.d/rc.local


:idea:
Puppy Raspup 8.2Final 8)
Puppy Links Page http://www.smokey01.com/bruceb/puppy.html :D

User avatar
BarryK
Puppy Master
Posts: 9392
Joined: Mon 09 May 2005, 09:23
Location: Perth, Western Australia
Contact:

#12 Post by BarryK »

Yes, you can run a program after the X GUI is started.

Open up /root/.xinitrc with a text editor.

Insert your program execution just before the last line.
Not after the last line, as "exec $CURRENTWM" exits from the script.

plockery
Posts: 26
Joined: Mon 13 Jun 2005, 09:28

#13 Post by plockery »

Thanks Barry.

That worked perfectly once I included the full path to rdesktop.

Much appreciated!

Peter

Mikrodots
Posts: 29
Joined: Fri 31 Mar 2006, 19:59
Location: Boston, MA USA
Contact:

Start rdesktop from ip-up; Failed to open display

#14 Post by Mikrodots »

I am trying to launch rdesktop from ip-up by calling a script named start_rdc:
/etc/rc.d/start_rdc

start_rdc runs perfectly when started directly. When I call it from ip-up I get the error ERROR: Failed to open display when the line /usr/bin/rdesktop -a 16 -f 1.2.3.4 runs

Also, gxmessage -title "rdesktop" -buttons "EXIT" "Quit" fails with the error: "gxmessage: unable to initialize GTK". gxmessage works fine if I call the script directly.

Not sure what the difference is running this script directly as opposed to launching it from ip-up. It looks like a user/permissions issue...

Puppy is fully booted at this point and xwin is running when start_rdc is launched from ip-up.

Any help would be appreciated.

Thanks,
Mikrodots

sodes
Posts: 7
Joined: Thu 22 Jan 2009, 22:36
Location: Chi-town

rdesktop

#15 Post by sodes »

I found this thread through the miracles of google...

I'm trying to convert some older PCs to become thin clients for a Windows Server 2003 Terminal Server. I installed the standard distro of puppy 4.1.2 and trimmed it down a bit. All in all, it's working fine. I installed rdesktop and got it working through the command line. I created a script in /bin so that i can run rdesktop with just one click once i put a sym link on the desktop.

There are two things more that i would like to accomplish:

1. Automatically start the rdesktop script once xwindows loads. I have tried putting the link to the rdesktop script into /root/startup but to no avail. It wouldn't run. I placed the line "/bin/rdesktop.sh" into the .xinitrc before the line "#exec $CURRENTWM". It won't startup because the network connection isn't available yet. Once loaded, if i restart the xserver it works just fine.

How can I get this script to run AFTER the network connection has been established?

2: I would like to have some kind of Daemon running to monitor the rdesktop process so that if the user closes it by logging out of rdesktop, the script will run and rdesktop will start back up.

Please help me if you can. I searched high and low to find a free alternative to convert old PCs into thin clients. Puppy and rdesktop is what i have come up with.

Thanks in advance.

User avatar
Pizzasgood
Posts: 6183
Joined: Wed 04 May 2005, 20:28
Location: Knoxville, TN, USA

#16 Post by Pizzasgood »

You could give the script a loop so that it will wait for a network connection.

Code: Select all

#don't bother starting until there's a network connection
NOCONNECTION=1
while [ ! $NOCONNECTION = 0 ]; do
  ping -c 2 google.com
  NOCONNECTION=$?
  [ ! $NOCONNECTION = 0 ] && sleep 10
done
rdesktop -w -h -a -t -e -v -e -r
Then place it in /root/Startup. It will start running when X starts, and will look for a connection every ten seconds. Once it sees a connection it will run the commands after the 'done'.
[size=75]Between depriving a man of one hour from his life and depriving him of his life there exists only a difference of degree. --Muad'Dib[/size]
[img]http://www.browserloadofcoolness.com/sig.png[/img]

Mikrodots
Posts: 29
Joined: Fri 31 Mar 2006, 19:59
Location: Boston, MA USA
Contact:

#17 Post by Mikrodots »

This is a couple years old now but it may help.

It did a lot more than start RDC -
Make sure xwin is running
Connected by bluetooth to the Inernet
Test Internet connection
Started Dynamic DNS
Created a VPN connection
Launch RDC

Of course the script won't run wthout a lot of other daemons and such.

You'll need to pick through and try the pieces you need, but it should help you write your own scripts to test if RDC is running, start RDC, test if the remote host is available etcetera.

script /etc/rc.d/startrdc

Code: Select all


#!/bin/sh
#
# startrdc
# Startup script for RDC
#

exec 1>>/var/log/rdc.log 2>&1
now=`date ‘+%d%m%y-%H:%M’`
echo -e “RUNNING STARTRDC $now

sodes
Posts: 7
Joined: Thu 22 Jan 2009, 22:36
Location: Chi-town

rdesktop startup

#18 Post by sodes »

Thanks Pizzasgood and Mikrodots for your help.

I'm currently using Pizzas implementation. It works well, but occasionally it causes xorg to lock up completely requiring a hard restart..... Not sure if that is the loop or something else entirely. Xvesa doesn't seem to have the problem though, so i may just stick with that.

Mikro, I like the looks of the script and i think i am going to adapt what i can to meet the needs of my system and setup. It is one helluva piece of work though.

I believe at this point I have a good idea of how i will get the rdesktop to autostart. Do either of you have any thoughts regarding restarting the process after the user closes it? At this point, if a user logs out of the terminal screen, they are dropped back down to the desktop. I'm looking for something that will monitor when the rdesktop process ends and restart a new process automatically. In effect, the user should never see the desktop. In the interim, i have created a link on the desktop labled "Click Me" to give the users something to restart rdesktop once the initial instance of rdesktop ends.

Thanks again!

User avatar
Pizzasgood
Posts: 6183
Joined: Wed 04 May 2005, 20:28
Location: Knoxville, TN, USA

#19 Post by Pizzasgood »

Not sure why it would cause X to hang.

For making it restart rdesktop, put the rdesktop command inside an infinite while loop, like this:

Code: Select all

while [ 1 ]; do
  rdesktop
done
So, overall it would be something like this:

Code: Select all

#!/bin/sh
NOCONNECTION=1
while [ ! $NOCONNECTION = 0 ]; do
  ping -c 2 google.com
  NOCONNECTION=$?
  [ ! $NOCONNECTION = 0 ] && sleep 10
done
while [ 1 ]; do
  rdesktop
done
[size=75]Between depriving a man of one hour from his life and depriving him of his life there exists only a difference of degree. --Muad'Dib[/size]
[img]http://www.browserloadofcoolness.com/sig.png[/img]

sodes
Posts: 7
Joined: Thu 22 Jan 2009, 22:36
Location: Chi-town

rdesktop

#20 Post by sodes »

Thanks for the quick reply Pizza! I will give it a try and let you know how it works out. Once i am finished, my goal it to continue working on the Thin Puppy and offer it as a new distro.

Post Reply