Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I have a server running Ubuntu Server 11.10 and I have some programs I want to start at boot time such as Nginx, my Unicorn workers etc.

In fact, I know how to start my programmes either by adding a script to /etc/init.d/ or to /etc/init/ via Startup.

What I want to know is if there is a "good way" or "best way" to do it. Maybe there is a more sustainable way considering the future evolutions of Ubuntu.

share|improve this question

2 Answers 2

up vote 3 down vote accepted

As with all things Linux, there are a bunch of different ways to do this.

The best way, though, is to write upstart files for the apps you need to start on boot. Upstart replaces the legacy sysV init system.

share|improve this answer
    
The real question is, how did he manage to install nginx without getting an init script? –  devicenull Feb 24 '12 at 0:27
    
When you install Nginx via apt, you get a nginx file in /etc/init.d/. I just removed it and replaced it with a file in /etc/init/. –  OyoKooN Feb 24 '12 at 0:35

What I do is make a copy of /etc/init.d/skeleton and adjust it to my needs. It's quite simple and I think it's the best way to implement starting up things at boot time. Don't forget to run "update-rc.d name-of-app defaults" or something similar to enable it.

Alternatively you can edit /etc/rc.local to your needs. No need to run update-rc.d in that case.

share|improve this answer
    
Thank you for your answer. –  OyoKooN Feb 24 '12 at 0:35

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.