Help - Search - Members - Calendar
Full Version: Making A Program Start When Linux Starts
Linuxhelp > Support > Technical Support
I have a bittorrent tracker setup on a server I use, the path to the executable is:

Is there a simple way I can make this launch whenever the server starts up? I'm pretty new to linux so all the rc.local stuff seems really confusing to me. Any help would be appreciated.

(I'm using Fedora Core 3)
Please open up /etc/inittab, and you should see a line near the begining that says something similar to:

# The default runlevel.

The number between id and initdefault is your run level.

Now go to /etc/rc2.d (or whatever) and ls

You should see a fairly large number of scripts that all start with


S = Script is run at boot time as /etc/rc2.d/S##scriptname start
K = Script is run at boot time as /etc/rc.d/S##scriptname stop

The number is the order it is run (which shouldn't matter if you're running a standalone program that doesn't rely on any other programs being up at the time of it's execution)

Pick a number that doesn't exist, and make two of these scripts (below)


#assumes that you want to run this program as a regular user (bnbt)
#you might have to fiddle with sudoers, but I doubt it
case "$1" in
       sudo -u bnbt /home/username/bnbt/bnbt        
       echo "started"
               killall -9 bnbt
               echo "stopped"
               echo "usage: $0 {start|stop}"
Thanks a lot for the help, the startup part appears to be working, but now I'm getting errors with bnbt. The problem seems to be that when ever its launched from a directory other than the one its in I get errors. Say I'm in /tmp and type:

I'll get these errors:
[Sun Aug 28 01:02:00 2005] server error - unable to bind socket (error 98)
[Sun Aug 28 01:02:00 2005] warning - unable to open dstate.bnbt for reading
[Sun Aug 28 01:02:00 2005] warning - unable to open tags.bnbt for reading
[Sun Aug 28 01:02:00 2005] warning - unable to open users.bnbt for reading
[Sun Aug 28 01:02:00 2005] server - start
[Sun Aug 28 01:02:00 2005] server - exit

But if I'm in /home/username/bnbt and type ./bnbt it runs fine. Do you know of anyway to fix this within the startup file you made earlier?
Add "cd /home/username/bnbt/" and then "./bnbt" to the shell script
Thank you very much DS2K3, I was going crazy trying to figure out why it wasn't working. Can't believe all I needed to do was add the cd line.
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2018 Invision Power Services, Inc.