Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1155
  • Last Modified:

Adding a command to run at boot time in RedHat 5

Hello,

I am trying to get a command to run at boot up on my RedHat 5 linux machine.  The command is
synergyc 111.111.111.111 &

Open in new window

I have added the command to my /etc/rc.d/rc.local file, but it still does not run.  I was wondering how i can get it to run.  Thank you.
0
Alex Matzinger
Asked:
Alex Matzinger
  • 5
  • 5
  • 2
  • +6
1 Solution
 
AriMcCommented:
The first thing to check is the file permissions as sometimes text editors remove the execute right from files when saving. So do a "ls -al /etc/rc.d/rc.local" and make sure there it looks like:

-rwxr-xr-x 1 root root 306 2009-03-08 20:35 rc.local

The 4th character "x" is the most important one.

0
 
HawyLemCommented:
Try to make it as a script and add it to the rc.local file

http://embraceubuntu.com/2005/09/07/adding-a-startup-script-to-be-run-at-bootup/
0
 
savoneCommented:
It should run at boot if it is in the rc.local file, you may not be getting the results you want because the network is coming up AFTER the command runs.  I am familiar with synergy. ;)

Try putting it in the startup programs in gnome.  It will start when you log in as the user and the network will be up already.

0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
savoneCommented:
Also another work around would be to put a sleep in front of it.

sleep 5; synergyc 111.111.111.111 &

Although this will slow down your boot up by 5 seconds. :)
0
 
Alex MatzingerDatabase AdministratorAuthor Commented:
@AriMc
I have made sure that the file is execuatble.

@HawyLem
I have tried the methods on that link as well.  Red Hat doesn't support 'update-rc.d' ( i also tried some of the methods in the comments of that page and couldn't get it to work)

@savone
I tried the sleep command and still nothing.  I think you are right about the network not being up when the command is being run.  I think i may just have to deal with logging in before the command starts.
0
 
savoneCommented:
That's what happened to me, so I added it in the gnome startup apps and it worked great.
0
 
de2ZotjesCommented:
rc.local is the very last bit of code that is run as part of the boot process. On an old-fashioned setup the network is up by that time. Newer installations that depend on network manager for the network connectivity will not provide connectivity until a user (who configured a network connection) logs in.

Depending on the role the machine fulfills you might want to promote your personal network configuration settings to system settings. Doing that and changing the setting [ifupdown] managed=false to managed=true should get you earlier connectivity.

You can even -if the box is a desktop- just use system-config-network to setup the connectivity
0
 
oppofwarCommented:
Open /etc/rc.sysinit and enter the command on the last line , it will run before network starts
0
 
oppofwarCommented:
ignore the previous comment , You have to enter it on the line before hostname is specified

ie. vi /etc/rc.sysinit

------Enter it here------
HOSTNAME=`/bin/hostname`

...............

0
 
savoneCommented:
@oppofwar - He needs it to run AFTER the network is up.
0
 
Monis MontherSystem ArchitectCommented:
Did you ever try using the full path of the command in your rc.local file??

The PATH variable has not been initialized yet to find your commands under /sbin/ usr/sbin ..etc

Now just to make things clear

1- rc.local is the last file excuted during a boot process and networking comes up much before that. You can examine that by yourself by pressing the letter ( i ) when booting up your machine at the stage where it says welcome to Red Hat Enterpise Linux press i for interactive booting.

2- commands under rc.local must be written using the full path of the command

3- I am not really sure of what the command does but if its something graphical then you need to set display and x-sessino info in the rc.local its not going to popup things for you. Otherwise if its a command that would run in the backgroun then it will be fine.
0
 
Alex MatzingerDatabase AdministratorAuthor Commented:
I have tried using the fill path of the command (/usr/bin/synergyc)  and it still does not work.  I am fairly certain that for this program i have to be signed in to allow it to work.  Not the end of the world, just means that i have to continue using two keyboards to log in.

Oh, and synergy is a program that allows a user to use one keyboard and mouse across multiple platforms(such as if you have a windows and linux or Mac machine side by side, you can use one keyboard and mouse to control them all)
0
 
savoneCommented:
Have you tried what I suggested in adding it to the gnome startup apps?

click System > Preferences > Startup Applications

Then click add and fill in the boxes.  

When you log into gnome it will start the service and the network will already be up.  This worked perfectly for me.
0
 
Alex MatzingerDatabase AdministratorAuthor Commented:
I have added it to my gnome start up, so currently once i log in it starts up.  I'm going to leave this question up a little longer just in case before i split the points up.
0
 
de2ZotjesCommented:
Depending on how strict the security for that box has to be you could setup automated login for it: http://www.linfo.org/automatic_login.html.
That way you no longer need 2 keyboards on your desk :)
0
 
joolsCommented:
Adding to /etc/rc.d/rc.local should be fine, the network is already up at this stage. The docs for synergy seem to require a -f option so you may need something like;

   /path/to/synergyc -f <ipaddress>

However, it may need X to be running for the session to work correctly in which case you need to add to the X startup (mentioned by savone above)

Are there any errors in the log files?
0
 
Alex MatzingerDatabase AdministratorAuthor Commented:
-f is just for running the program in the foreground to verify it is working, but is not required.  I haven't found any errors in the log files.  For this program it appears that i'm just going to have to be satisfied with starting it when i log into the machine.
0
 
Martin_J_ParkerCommented:
Yes, X does have to be running to start synergyc
See http://synergy2.sourceforge.net/autostart.html
0
 
Alex MatzingerDatabase AdministratorAuthor Commented:
It does not appear that i can get this to run on boot up, so the best solution is to make it start when i log in
0

Featured Post

Free Backup Tool for VMware and Hyper-V

Restore full virtual machine or individual guest files from 19 common file systems directly from the backup file. Schedule VM backups with PowerShell scripts. Set desired time, lean back and let the script to notify you via email upon completion.  

  • 5
  • 5
  • 2
  • +6
Tackle projects and never again get stuck behind a technical roadblock.
Join Now