Linux CentOS 5.4 Auto run not runing /etc/rc.d/rc.local

I am trying to run rdesktop with switches on start-up.  The system will be a thin-client only connecting to a 2003 TS.  The first thing the user will see after boot up is the Logon screen for the TS.  The Linux box will login and run rdesktop ideally.  I have the command & switches in the  /etc/rc.d/rc.local.  If I run the file it launches rdesktop but the OS does not run it on start up.  If I add the file to the session manager it launches but then the desktop replaces the TS logon screen.  Any ideas is welcome, thanks.
LVL 1
Hacking_For_ChristAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

deepak_iqCommented:
If you want to run it during startup and if it is not getting started during boot then you keep it in init.d and enable it by chkconfig. Verify that it is enabled for your run-level and reboot your server. Hopefully it should start once the server comes up after reboot.

If still getting error,send me the details.
0
nabeelmoiduCommented:
assuming X is your runlevel,
check if the file in /etc/rcX.d/
is
S99local
or
K99local

if its K, move it to S.
0
Hacking_For_ChristAuthor Commented:
I will look at these in the morning when I am in the office thanks
0
The Ultimate Tool Kit for Technolgy Solution Provi

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy for valuable how-to assets including sample agreements, checklists, flowcharts, and more!

Hacking_For_ChristAuthor Commented:
When I tried chkconfig, it tells me  the TS can not be configured in chkconfig.

When I tried placing the file in the \etc\rc5.d nothing happens

I tried both and neither work, what else can I try, thanks for the help.
0
Michael WorshamStaff Infrastructure ArchitectCommented:
Can you post a copy of your script here so we can see what it is you're trying to do, then possibly come up with a solution for it?
0
Hacking_For_ChristAuthor Commented:
Here is the original rc.local file I added to:

touch /var/lock/subsys/local
rdesktop -f -a16 -u USERNAME -k en-us TS.X.com

Then I also tried just the :

rdesktop -f -a16 -u USERNAME -k en-us TS.X.com

If I double click and run the file it works but just not autorun.
0
Michael WorshamStaff Infrastructure ArchitectCommented:
I created a quick and dirty script (see below) that is chkconfig usable. Just copy and paste it into a file called rdesktop_control and put it in the /etc/init.d directory. Then do 'chmod +x /etc/init.d/rdesktop_control' and 'chkconfig rdesktop_control on'.

Inside the rdesktop_control script, there are a couple of variables you need to change before it can be usable:

USERNAME=*changeme*
SERVERNAME=*changeme*

Then try doing '/etc/init.d/rdesktop_control start' and see if that works for you.

NOTE: The rdesktop application will NOT run unless it can open the display, so the server needs to have X-Windows running (i.e. init 5).

#!/bin/sh
#
# RDesktop Control Script (rdesktop_control)
#
# chkconfig: 2345 95 20
# description: Quick and dirty script to start/stop the rdesktop
# processname: rdesktop_control

RDP_DIR=/usr/bin/
LOG=/dev/null
RDP=rdesktop

# change these as per requirements
USERNAME=*changeme*
SERVERNAME=*changeme*

# source function library
. /etc/rc.d/init.d/functions

cd $RDP_DIR

if ! test -x $RDP
then
  echo "$RDP is not executable"
  exit 0
fi

rdp_start()
{
  echo -n "Starting: rdesktop "
  $RDP_DIR/$RDP -f -a16 -u $USERNAME -k en-us $SERVERNAME >> $LOG
  sleep 1
  return 0;
}

rdp_stop()
{
  echo -n "Stopping: rdesktop "
  killall $RDP >> $LOG
  return 0;
}

is_rdp_running()
{
  ps u --noheading -C $RDP | grep -q -i $RDP
  if test $? -eq 0
  then
    return 1;
  else
    return 0;
  fi
}


check_up()
{
  # Cleanup : If rdp isn't running, but the pid exists, erase it.
  is_rdp_running
  if test $? -eq 0
  then
    if test -e /var/run/rdp.pid
    then
      rm /var/run/rdp.pid
    fi
  fi
  return 0;
}

case "$1" in
  start)
    check_up
    is_rdp_running
    if ! test $? -eq 0
    then
      echo "rdesktop is already loaded "
      exit 1
    fi
    rdp_start
    ;;
  stop)
    check_up
    is_rdp_running
    if test $? -eq 0
    then
      echo "rdesktop is not loaded "
    fi
    rdp_stop
    ;;
  force-reload|restart)
    check_up
    echo "Restarting rdesktop "
    rdp_stop
    is_rdp_running
    while ! test $? -eq 0
    do
      check_up
      sleep 1
      is_rdp_running
    done
    rdp_start
    ;;
  *)
    echo "Usage: rdesktop_control {start|stop|restart|force-reload}"
    exit 1
esac

exit 0

Open in new window

0
Hacking_For_ChristAuthor Commented:
The script when ran manual works but as a service it does not open the TS windows.  When I restart it as a service in Gnome nothings happens. I check in chkconfig it shows it running in lvl 2-5 but no window.  I like the script; any other ideas to get this to show the window?
0
Michael WorshamStaff Infrastructure ArchitectCommented:
It's quite possibly that this application cannot run as a foreground 'service', thus no window is appearing.

Example:
 - VNCServer is a terminal services background 'service'.
 - Rdesktop is like Windows version of RDP, thus a foreground application and not a service.

Thus even the /etc/rc.local way of kicking off the script won't be possible unless the XWindows system environment is already up and actively running.
0
Michael WorshamStaff Infrastructure ArchitectCommented:
One option I can think of would be to autostart the rdesktop application when the XWindows environment comes up fully...

Autostart programs in KDE or GNOME - the manual way
http://www.captain.at/howto-autostart-program-in-kde-gnome.php

How to autostart any program when Gnome desktop session starts
http://blog.taragana.com/index.php/archive/how-to-autostart-any-program-when-gnome-desktop-session-starts/
0
Hacking_For_ChristAuthor Commented:
We ended up running flux and not GNOME.  From there we got it to auto start
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Linux

From novice to tech pro — start learning today.