Find the answer to your Linux question:
Results 1 to 8 of 8
Hi, guys! How to start a program at system startup? Just add a line in some system configuration file? Or is there a way other than this?...
  1. #1
    Just Joined!
    Join Date
    Feb 2008
    Posts
    21

    Start a program at system startup

    Hi, guys!
    How to start a program at system startup? Just add a line in some system configuration file? Or is there a way other than this?

  2. #2
    Linux Enthusiast gerard4143's Avatar
    Join Date
    Dec 2007
    Location
    Canada, Prince Edward Island
    Posts
    714
    try googling "Linux configure your sessions"...Hope this helps or try this link

    Configuring Sessions (GNOME 2.2 Desktop on Linux User Guide) - Sun Microsystems

  3. #3
    Linux User
    Join Date
    Mar 2008
    Posts
    287
    Would using "cron" help? Probably could initiate from .bashrc too.

  4. #4
    Linux Engineer wje_lf's Avatar
    Join Date
    Sep 2007
    Location
    Mariposa
    Posts
    1,192
    How to start a program at system startup?
    try googling "Linux configure your sessions.
    No, he's interested in doing something at system startup, not when he starts a session.
    Would using "cron" help?
    No, he's interested in doing something at system startup, not at a particular point in clock time.
    Probably could initiate from .bashrc
    No, he's interested in doing something at system startup, not when he fires up a new bash shell.

    The answer depends on your particular Linux distribution. Linux distributions have various ways of organizing their startup files.

    For example, in Slackware (which is what I run), you'd probably want to place your startup code in /etc/rc.d/rc.local, but if the desired program is to be run continuously, even while the rest of the system is running, make sure you have an amperstand at the end of the line:
    Code:
    asdf asdf qwerty &
    or the initialization won't continue until the program is finished. Nobody likes his system to take an infinite time to boot up.

    Also, since the program will be running at system startup, it will be run before anyone logs in. This means that it will run as root, and won't have most of the normal environment variables set, such as a home directory.

    Consult the documentation for your particular distribution. Maybe, if you say in this thread which distribution you're using, someone will come along and say which file you should modify.

    Hope this helps.
    --
    Bill

    Old age and treachery will overcome youth and skill.

  5. #5
    Just Joined!
    Join Date
    Feb 2008
    Posts
    21
    I still cannot figure out. I'm using Ubuntu. Can anyone help?

  6. #6
    Linux Engineer wje_lf's Avatar
    Join Date
    Sep 2007
    Location
    Mariposa
    Posts
    1,192
    Yeah, my wife runs Ubuntu. The file in question is
    Code:
    /etc/rc.d
    If you use vi, you need to do this:
    Code:
    sudo vi /etc/rc.d
    If whatever you put in there is something which could run a long time, so you don't want to wait for it to finish before continuing the boot process, be sure to put the ampersand (&) at the end of the command, or you system might not make it all the way up. It might just be running your program forever.
    --
    Bill

    Old age and treachery will overcome youth and skill.

  7. #7
    Linux Engineer wje_lf's Avatar
    Join Date
    Sep 2007
    Location
    Mariposa
    Posts
    1,192
    Oops! My bad! Not /etc/rc.d, but /etc/rc.local

    Sorry for the confusion. :(
    --
    Bill

    Old age and treachery will overcome youth and skill.

  8. #8
    Just Joined!
    Join Date
    Feb 2008
    Posts
    21
    I made it. The original mistake is that I forgot to write the full path name in rc.local. Thanks!

Posting Permissions

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