2

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.

EEAA
  • 108,414
  • 18
  • 172
  • 242
4e4c52
  • 153
  • 2
  • 6

2 Answers2

3

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.

EEAA
  • 108,414
  • 18
  • 172
  • 242
  • The real question is, how did he manage to install nginx without getting an init script? – devicenull Feb 24 '12 at 00: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/. – 4e4c52 Feb 24 '12 at 00:35
0

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.

Soviero
  • 4,306
  • 7
  • 34
  • 59
aseq
  • 4,550
  • 1
  • 22
  • 46