Software updates by Troy D. Hanson


upstart: init in Ubuntu
February 28, 2011, 6:04 pm
Filed under: Software updates

Here’s an example of software just working well: I went to write a “startup script” for my process (you know, one of those init.d startup scripts that gets your process going when the box is rebooted). I learned that, on Ubuntu, the init process has been replaced with the very friendly “upstart” package.

Here’s how a startup script looks. This is for the acpid daemon:

# acpid - ACPI daemon
#
# The ACPI daemon provides a socket for other daemons to multiplex kernel
# ACPI events from, and a framework for reacting to those events.
description   "ACPI daemon"
start on runlevel [2345]
stop on runlevel [!2345]
expect fork
respawn
exec acpid -c /etc/acpi/events -s /var/run/acpid.socket

I copied this file (renaming it for my own process and adjusting the exec line), put the file in /etc/init/pm.conf and voilĂ – my work was done. I just had to start up the process manually the first time using,

service pm start

A few pointers:

  • If you want to see the upstart logs, look in /var/log/daemon.log.
  • upstart itself is documented in init(8) (man -s 8 init)
  • the conf file syntax is documented in init(5) (man -s 5 init)
Advertisement

Leave a Comment so far
Leave a comment



Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s



Follow

Get every new post delivered to your Inbox.