Log into server (with rdesktop) on bootup?

Booting, installing, newbie
Message
Author
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.

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

rdesktop

#21 Post by sodes »

.

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

rdesktop.... again....

#22 Post by sodes »

Thank you for all the help up to this point. I am looking for your assistance once again....

The Puppy Thin Client works very well. Upon booting up, the terminal login screen is presented just the way i wanted it to be. When you logout, it restarts rdesktop just the way it is supposed to.

One thing i am noticing though is that after a certain amount of time, if rdesktop isn't logged in, the process will die and have to be restarted. I'm guessing that there is some type of inactivity monitor that kills the process if it doesn't actually log in.

So my question is..... Is there a way to prevent the process from being killed due to inactivity, OR increase the amount of time a process can be inactive before it is killed?

Thanks for your help.

Bruce B

#23 Post by Bruce B »

The problem is things that were true may not be true now.

rc.network may have ran sequentially then, I don't remember, but it runs in the background now.

It is a little hard to tell when rc.network is finished without a method. It could still be running after rc.local, after profile and even after X boots.

rc.network is designed for a wide range of networking possibilities. Then there is the time delay inherent with DHCP.

I don't have a wide range of possibilities, so I don't need rc.network to check all these things. For this reason I wrote my own script, which brings the network up in less than a second. There is no backgrounding or guessing. I know when my network is up, that is the instant the script commands return.

This concludes an overview of the problem.

==================

As for what you can do.

Like I do?

Don't let rc.network background, this way by the time you get to /etc/profile it has finished and you can start the service in profile.local or rc.local (the booting would take longer)

If you have a cabled network and can make a static IP address because you are behind a router, I could tell you the commands to run.

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

#24 Post by sodes »

Actually Bruce, the network comes up on time before rdesktop even attempts to run for the first time. I'm using Pizza's script to check for a ping before continuing with bringing up rdesktop.

The problem revolves around rdesktop itself....

after the PC boots up..

rdesktop starts, The Windows Server 2003 Terminal Services login screen is displayed fullscreen. If a user doesn't log in, the login screen sits there waiting....... For about 10 minutes or so when the rdesktop instance closes. It appears that if it is inactive for a period of time (10 minutes), the process just dies on it's own.

what I am trying to figure out is how to get it to stay alive indefinitely, or if I can't keep it alive indefinitely, to increase the inactive time for as long as possible. I want the rdesktop process to stay running forever, until a user is able to login.


Any ideas?

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

#25 Post by Mikrodots »

Sorry for the delay.

Windows Terminal Service will kill the connection after a login timeout period.

The default session timeout (not to be confused with login timeout) is two hours.

You will have to detect the connection is dropped and then restart RDC. I don't know if the login timeout can be set to infinity on the terminal server.

You could try the AutoLogon feature of TS - big security problem there - but if you don't care about that...

Mikrodots

Post Reply