0

I am reading the book Ubuntu Server Book 2nd Edition. It states the following:

At the moment, Upstart does replace the functionality of init and the /etc/inittab file and manages changes to run- levels, system start-up and shutdown, console ttys, and more and more core functionality is being ported to Upstart scripts

My take from this is that upstart handles starting up scripts on run-levels. So if run-level 2 was entered, it will be Upstart and not System V that starts the script, which in turn starts the executable program.

So I have installed postgresql from the repositories. And indeed when system starts up, the postgres daemon runs in the background. Obviously if System V didn't do this, then it must have been Upstart that performed this task. But when I go to /etc/init, which is where all the upstart scripts reside, there is no reference to postgresql anywhere. However, when I go to /etc/rc1.d, which is where run-level 1 scripts reside, I indeed find a postgresql script:

$ ls -l | grep postgresql
lrwxrwxrwx 1 root root  20 Jun  1 11:10 K21postgresql -> ../init.d/postgresql

So why is there no upstart script for postgresql and without an upstart script, how is postgresql starting up?

Donato
  • 613

1 Answers1

1

Yes on version 14; no on version 15.

On Ubuntu Linux version 14: yes, upstart truly is handling all of this. You need to read the part of the Cookbook that discusses how it handles programs that come only with old System 5 rc scripts, and the manual page for upstart "runlevel" events. There's a whole mechanism for invoking the old System 5 rc program. It's just another job as far as upstart proper is concerned.

On Ubuntu Linux version 15; no, upstart is not involved any more. systemd is handling all of this. systemd has mechanisms for old System 5 rc scripts. However, the /etc/init.d/postgresql file that you are looking at is irrelevant on version 15. PostgreSQL comes with two systemd service unit files in version 15, /lib/systemd/system/postgresql@.service and /lib/systemd/system/postgresql.service. System 5 rc stuff is thus completely ignored.

Further reading

JdeBP
  • 3,979