2

I'm trying to run a service when the system starts up by following this tutorial

I have a script named service.

To make it run on startup, I ran

 sudo update-rc.d service enable

and then rebooted using sudo reboot and it works.

I'm curious as to whether I need to add a respawn line or not since it is used in this article. In my case it works even I do not add that line.

Add a respawn line for this service at the bottom of the /etc/inittab file. Here's a generic example:

/etc/inittab

id:2345:respawn:/bin/sh /path/to/application/startup

My Ubuntu version : 14.04

11
  • If that article uses /etc/inittab, it is really outdated. No current version of Ubuntu uses it. What version are you using?
    – muru
    Feb 8, 2017 at 4:32
  • @muru 14.04. So I can just ignore that part ?
    – John Joe
    Feb 8, 2017 at 4:33
  • 1
    If you're using 14.04, use an Upstart job instead of /etc/init.d/ scripts.
    – muru
    Feb 8, 2017 at 4:34
  • @muru What's the difference ? It working also
    – John Joe
    Feb 8, 2017 at 4:35
  • 2
    Respawn automatically restarts the service if it crashes.
    – muru
    Feb 8, 2017 at 4:47

1 Answer 1

2

Respawn command is used to restart a process if it is not running currently in the system. If the process get stopped in the system, then respawn can be used to trigger the starting of the process.

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