state-change-notify(8)

STATE-CHANGE-NOTIFY(8) STATE-CHANGE-NOTIFY(8)

NAME

state-change-notify - system state transition notification service

SYNOPSIS

state-change-notify HANDLER STATE

DESCRIPTION

state-change-notify should be called when a system state transition is in progress. It is a wrapper script that performes the common procedures: determines the particular state change event and define message draft. It then calls the actual handler as follows:

/etc/state-change-notify/actions.d/<handler> STATE SUBJECT MESSAGE

In order to determine the actual system state systemctl(1) currently is used.

CONFIGURATION

/etc/state-change-notify is the main configuration directory with (currently empty) main configuration file main.conf. There are also configuration files for the notification handlers, for instance, mail.conf (state-change-notify-mail(5)) for the E-Mail notification handler (such as state-change-notify-postfix(8)).

The handlers are placed in the actions.d directory. See the state-change-notify-mail(8) handler for example.

ENVIRONMENT

Each notification handler is called with the following set of environment variables:

  • CONFIG -- the main configuration file, normally /etc/state-change-notify/main.conf;
  • CONFDIR -- the configuration directory path, normally /etc/state-change-notify;
  • ACTIONDIR -- the handlers directory path, normally /etc/state-change-notify/actions.d;
  • HANDLER -- the handler path: /etc/state-change-notify/actions.d/<handler>;
  • STATE -- the name of the event (´reboot´, ´shutdown´, etc.);
  • SUBJECT -- the draft message subject the handler can use as is for most of the cases;
  • MESSAGE -- the draft message body the handler can use as is for most of the cases.

SEE ALSO

state-change-notify-postfix(8), state-change-notify-mail(8), state-change-notify-mail(5), systemd(8)

July 2021