getting a program to autostart after reboot?

doh-nut

Supreme [H]ardness
Joined
Dec 7, 2000
Messages
5,409
on debian, im trying to make my teamspeak server start by itself after reboot. i installed samba, and i noticed it starts exactly where i wanted it to, before someone even logs in. is there a way to make the teampseak server start in the same fashion?
 
I don't know about debian, but it will have something to do with the init system. I hope some one else can respond, as I use Slackware myself and the init system is pretty different from most Linux distros, as it uses straight forward rc scripts more like BSD's init then SysV like most distros.
 
some people have to told me that /etc/init.d/skeleton is what to use, but well, its contents are all greek to me, i have no clue what to do in there. i was hoping there would be some file where i could simply give commands like cd /teamspeak then ./teamspeakserver start which gets executed on startup
 
You could write a proper start-up/shutdown script, put it in the right place and symlink it to the right runlevels...

You could look at /etc/rc.local if you want. Check to see if there's a man page for that.

Hell, you could write a short sh script to check the status of the teamspeak server and (re)start the server if it's not running, then run that script every ten minutes from cron or something.
 
[H]EMI_426 said:
You could write a proper start-up/shutdown script, put it in the right place and symlink it to the right runlevels...

You could look at /etc/rc.local if you want. Check to see if there's a man page for that.

Hell, you could write a short sh script to check the status of the teamspeak server and (re)start the server if it's not running, then run that script every ten minutes from cron or something.

i 'could' do these things, if i knew how :). but 1 and 3 really don't make sense to me at all, number 2 does, but that file isn't present on my debian.

ive been googling and finding a lot of info about how to get my linux server working, but i just can't seem to find a link for a procedure for making programs start up after boot from start to finish in a noobie-friendly explanation.
 
You place a normal text file in /etc/init.d/ with the commands that you want to have executed when you boot. Then make a sym link to that file in /etc/rcS.d/ . The symbolic link in /etc/rcS.d/ will have to start with a capital "S". cat /etc/rcS.d/README for more info on that. Set the file permissions on the one you created in /etc/init.d/ to "chmod 755"
 
just writing whatever the command to start the teamspeak server is at the bottom of rc.local is a lot simpler, though. :)
 
AdamW said:
just writing whatever the command to start the teamspeak server is at the bottom of rc.local is a lot simpler, though. :)

ok, I didn't have one, so i made one with vi. i put the following

cd /usr/tss2_rc2
./teamspeak2-server_startscript restart

but when i reboot, nothing happens. ive been trying to find a sample rc.local of somebody who has a program start up but i haven't been able to :(

Gertrude said:
You place a normal text file in /etc/init.d/ with the commands that you want to have executed when you boot. Then make a sym link to that file in /etc/rcS.d/ . The symbolic link in /etc/rcS.d/ will have to start with a capital "S". cat /etc/rcS.d/README for more info on that. Set the file permissions on the one you created in /etc/init.d/ to "chmod 755"

i tried this, but also failed. i looked at the existing symbolic links in there to get an idea of whats happening, and when i vi them, they hold the same data as the things they are pointing to. is this because they have to contain the same stuff as what they are pointing at or is it because they are made a special way other than making one with vi so when you do vi them it just forwards you to what its pointing at?

edit: ill figure this out soon i think, found a very good tutorial. thanks for pointing me in the right direction
 
doh-nut said:
i 'could' do these things, if i knew how :).
That's why I suggested these things. It gives you a nudge in the right direction, but still forces you to do a lot of learning on your own.
 
doh-nut: using userish commands like cd in scripts isn't a good idea. try just this instead:

/usr/tss2_rc2/teamspeak2-server_startscript restart

If you don't have an rc.local, though, that's odd, and just creating a blank file with a command in it probably won't work. Maybe Debian's startup is different from most other distros? If so you'll need a Debian guy to help you out, sorry. Most distros include a rc.local already, it's in a proper script format and is called by one of the more 'users-don't-touch-this' startup scripts. If Debian doesn't have one, maybe it has a different system. Any Debian guys to help out?
 
AdamW said:
doh-nut: using userish commands like cd in scripts isn't a good idea. try just this instead:

/usr/tss2_rc2/teamspeak2-server_startscript restart

i tried that, but then the teamspeak script says it can't find server_linux which is an executable that is supposed to be launched by the teamspeak script.
 
better read the links deuce and gertrude posted, I think :). thanks guys!
 
AdamW said:
better read the links deuce and gertrude posted, I think :). thanks guys!

i got it to work a while ago, but im just saying ive tried every syntax imaginable so that i don't have to manually type CD, but there just doesn't seem to be a way that i can find
 
doh-nut said:
i tried that, but then the teamspeak script says it can't find server_linux which is an executable that is supposed to be launched by the teamspeak script.
This is because the teamspeak server uses relative paths (naughty, naughty!). In this case it is best to just cd to the proper place before running it.

Did you make /etc/rc.local executable? 'chmod +x /etc/rc.local' will do the trick. This tells linux that it's okay to treat the contents of this file as a script rather than just some odd-looking text.
 
The idiot proof, simple way (if you know it will always work and you don't need to stop it) is to throw it into inittab. Punch up the syntax for it if you want, I use it to start folding on my systems.
 
Back
Top