Find the answer to your Linux question:
Results 1 to 6 of 6
Hi, I need to start a program on bootup. I've read a little on the subject and I see different possibilities and I'm not sure which to use. I'm using ...
  1. #1
    Just Joined!
    Join Date
    May 2009
    Posts
    72

    Question Starting program on bootup

    Hi,

    I need to start a program on bootup. I've read a little on the subject and I see different possibilities and I'm not sure which to use. I'm using Centos.

    Should I put my program in etc/inittab?
    Should I put it in etc/rc.d/rc.local?
    Should I put a script it in /etc/rc.d/init.d?

    Any advice or recommendation would be much appreciated.

    Thank you.

    olacelle

  2. #2
    Linux Engineer hazel's Avatar
    Join Date
    May 2004
    Location
    Harrow, UK
    Posts
    955
    I take it you're talking about a background daemon. I'd start it in rc.local. That's what rc.local is for. The scripts in init.d need to follow quite complex conventions to make sure that they're bullet-proof, as you can see by looking at one of them. Best not to meddle with them!
    "I'm just a little old lady; don't try to dazzle me with jargon!"

  3. #3
    Just Joined!
    Join Date
    May 2009
    Posts
    72
    Yeah it's background daemon. I like the rc.local solution although it is not working at the moment. I simply added a line in /etc/rc.d/rc.local that looks like this:

    /MyProgramPath/MyProgram

    Now when I boot it hangs on a blue screen just before the username prompt.
    I had to get by this by pressing 'I' on bootup (interactive) and answer 'N' when starting 'Local'. Is my synthax wrong?

    Thanks

    olacelle

  4. #4
    Just Joined!
    Join Date
    May 2009
    Posts
    16
    yes u can put it in /etc/rc.d/rc.local

  5. #5
    Linux User
    Join Date
    Jan 2006
    Posts
    414
    Quote Originally Posted by olacelle View Post
    Yeah it's background daemon. I like the rc.local solution although it is not working at the moment. I simply added a line in /etc/rc.d/rc.local that looks like this:

    /MyProgramPath/MyProgram

    Now when I boot it hangs on a blue screen just before the username prompt.
    I had to get by this by pressing 'I' on bootup (interactive) and answer 'N' when starting 'Local'. Is my synthax wrong?

    Thanks

    olacelle
    Code:
    /MyProgramPath/MyProgram &
    in rc.local will do the trick, the & will run the program in the background and therefore not hang the boot process.

  6. #6
    Just Joined!
    Join Date
    May 2009
    Posts
    72
    That's what I was missing. It did the trick. Thanks a lot darkrose0510!

    olacelle

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
...