Need help in making a program auto start when reboot

Hi, how can I make a program auto start when my server reboots?

5 Replies

What distro are you using and what program?

I'm using CentOS 5 , I wanted to make my apache run when system reboots.

#chkconfig httpd on

chkconfig –list httpd

I'm sorry to bump this thread again, but I still don't know how to autorun a program when it restarts, I want my TeamSpeak or other programs to go up when server restarts. How can I do that?

For a service with an init script provided for CentOS, vonskippy's method of using chkconfig is probably the best. A quick search shows that there are a number of init scripts for Teamspeak floating around there; I have no idea of their quality.

Another way of doing it is to have cron start the service. As an example, here's how you could automatically start your Teamspeak server.

First, change to the user account you want the server to run as ("teamspeak" in this case).

su - teamspeak

Then, unless you are familiar with vi, set an editor to use. Nano is pretty easy to get started with. (If it is not installed, yum install nano will do so.)

export EDITOR=/usr/bin/nano

Now you can edit the crontab file.

crontab -e

Insert the following line.

@reboot /full/path/to/teamspeak/server/program > /dev/null 2>&1 &

Then save the file and exit the editor. Now you can exit your session as the teamspeak user.

exit

When your system is rebooted (actually, any time the cron daemon restarts), the Teamspeak server will be run.

Reply

Please enter an answer
Tips:

You can mention users to notify them: @username

You can use Markdown to format your question. For more examples see the Markdown Cheatsheet.

> I’m a blockquote.

I’m a blockquote.

[I'm a link] (https://www.google.com)

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct