Linode Forum Index Linode Forum
Linode Community Forums
 


Need help in making a program auto start when reboot

Click here to go to the original topic

 
       Linode Forum Index -> General Discussion
Author Message
ronsoriano



Joined: 17 Oct 2011
Posts: 27

Posted: Sat Oct 29, 2011 6:50 pm    Post subject: Need help in making a program auto start when reboot  

Hi, how can I make a program auto start when my server reboots?
Back to top  
obs



Joined: 07 Mar 2010
Posts: 1403
Location: Earth

Posted: Sun Oct 30, 2011 2:34 am    Post subject:  

What distro are you using and what program?
Back to top  
ronsoriano



Joined: 17 Oct 2011
Posts: 27

Posted: Sun Oct 30, 2011 7:45 pm    Post subject:  

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



Joined: 27 Dec 2009
Posts: 469
Location: Colorado, USA

Posted: Sun Oct 30, 2011 8:22 pm    Post subject:  

#chkconfig httpd on

#chkconfig --list httpd
Back to top  
ronsoriano



Joined: 17 Oct 2011
Posts: 27

Posted: Sun Nov 06, 2011 7:52 pm    Post subject:  

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?
Back to top  
Vance



Joined: 18 Jan 2009
Posts: 354

Posted: Tue Nov 08, 2011 1:08 am    Post subject:  

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).

Code: 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.)

Code: export EDITOR=/usr/bin/nano

Now you can edit the crontab file.

Code: crontab -e

Insert the following line.

Code: @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.

Code: exit

When your system is rebooted (actually, any time the cron daemon restarts), the Teamspeak server will be run.
Back to top  
 
       Linode Forum Index -> General Discussion
Page 1 of 1