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?

  • you do know that upstart is depreciated in favor of systemd starting with ubuntu 15.04 ? – Panther Jun 6 '15 at 4:42
  • @bodhi.zazen no I did not know that. According to the book, upstart is the future and systemv is dead. Since I am using 14.04, I still would like an answer to this question. – Donato Jun 6 '15 at 5:58
  • How about Xinetd? Is that deprecated too? – Donato Jun 6 '15 at 6:32
  • @Donato /etc/init.d is used by system v init tools. Look here . As for Upstart, If I remember correctly from @muru explaining it is that when Upstart does not find a necessary script in /etc/init it goes to /etc/init.d , so there has to be at least one script in each folder for the job to start. So yes, Upstart does handle it all – Sergiy Kolodyazhnyy Jun 6 '15 at 8:39
  • It sort of depends on what you want to learn and what you need. If you are needing to write upstart scripts for a LTS version of Ubuntu, such as 14.04, then yes you will need to learn upstart. However, for almost everything else systemd is the way of the future for most distros including Debian and Ubuntu so if you are wanting to learn something that is going to be of use moving forward I would suggest learning systemd. Not really trying to start flame wars here, just passing on information - see markshuttleworth.com/archives/1316 – Panther Jun 6 '15 at 13:35

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

Your Answer

 

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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