init: support custom actions

Bug #94873 reported by Alex Smith on 2007-03-22
This bug affects 8 people
Affects Status Importance Assigned to Milestone

Bug Description

Initctl should have a reload command which allows you to send a signal to a process, SIGHUP by default, although it should allow you to specify a different signal such as SIGUSR1. This would be the equivalent of having a reload command in a sysvinit script. It is useful for if you need to send SIGHUP to a process without using hacks to find the pid.

The way in which I've been thinking of doing this is to permit the job to define custom actions (in addition to those built-in during the usual job cycle).

These actions would be permitted to be run while the job is running, and would receive the current pid as an environment variable, etc.

If you look at the upstart code, you'll see that most of the support is already there for this and it just needs completing.

In particular, the syntax for specifying them in the configuration file.

Changed in upstart:
importance: Undecided → Wishlist
status: Unconfirmed → Confirmed
Changed in upstart:
status: Confirmed → Triaged
Changed in upstart:
status: Triaged → Fix Committed
status: Fix Committed → Confirmed
Changed in upstart:
milestone: 0.5 → none
Changed in upstart:
milestone: none → 0.10

Custom actions should be able to be binaries of scripts (exec/script) as with other job processes, and also should be able to be signals to send to the running process.

We'll want to define whether the action can only run while the job is running, or whether it's a detacted action that can run anytime.

summary: - Initctl should have a reload command
+ init: support custom actions
Changed in upstart:
milestone: 0.10 → none
status: Confirmed → Triaged

The last time I wrote down the syntax for this, it looked like:

  action reload
    signal HUP
  end action

  action graceful
    exec /usr/sbin/apache2 -k graceful
  end action

  action rotate-logs
    exec ...
  end action

  action remote-sync
    while network-device
    exec ...
  end action

  action backup
    exec ...
  end action

Marques Johansson (marques) wrote :

While installing "blueman" from the ppa, I encountered this problem - sort of. /sbin/reload needed to exist.
Following the way "restart", "start", and "stop" were made executable, this was my workaround:
sudo ln -s initctl /sbin/reload

Bryan McLellan (btm) wrote :

Bug #433544 added support for reload in upstart >= 0.6.3-4, separately from other 'custom action' functionality.

James Hunt (jamesodhunt) wrote :

Although custom actions would allow a great deal of flexibility, this might be somewhat of a "double-edged sword".

After discussions at UDS-P (, it was generally agreed that a first step would be to enhance the abilities of the 'reload' and 'restart' commands. Since the current command set covers 99% of all known use-cases so custom actions are being deferred for the time being.

See bug 893021.

To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Related blueprints