Next: , Previous: , Up: Component Statement   [Contents][Index]


3.3.7 Exit Actions

The default behavior of pies when a ‘respawn’ component terminates is to restart it. Unless the component terminates with 0 exit code, a corresponding error message is issued to the log file. This behavior can be modified using return-code statement:

Config: component: return-code
return-code codes {
  …
}

The codes argument is a list of exit codes or signal names. Exit codes can be specified either as decimal numbers or as symbolic code names from the table below:

NameNumeric value
EX_OK0
EX_USAGE64
EX_DATAERR65
EX_NOINPUT66
EX_NOUSER67
EX_NOHOST68
EX_UNAVAILABLE69
EX_SOFTWARE70
EX_OSERR71
EX_OSFILE72
EX_CANTCREAT73
EX_IOERR74
EX_TEMPFAIL75
EX_PROTOCOL76
EX_NOPERM77
EX_CONFIG78

Table 3.3: Standard Exit Codes

Signal numbers can be given either as ‘SIG+n’, where n is the signal number, or as signal names from the following list: ‘SIGHUP’, ‘SIGINT’, ‘SIGQUIT’, ‘SIGILL’, ‘SIGTRAP’, ‘SIGABRT’, ‘SIGIOT’, ‘SIGBUS’, ‘SIGFPE’, ‘SIGKILL’, ‘SIGUSR1’, ‘SIGSEGV’, ‘SIGUSR2’, ‘SIGPIPE’, ‘SIGALRM’, ‘SIGTERM’, ‘SIGSTKFLT’, ‘SIGCHLD’, ‘SIGCONT’, ‘SIGSTOP’, ‘SIGTSTP’, ‘SIGTTIN’, ‘SIGTTOU’, ‘SIGURG’, ‘SIGXCPU’, ‘SIGXFSZ’, ‘SIGVTALRM’, ‘SIGPROF’, ‘SIGWINCH’, ‘SIGPOLL’, ‘SIGIO’, ‘SIGPWR’, ‘SIGSYS’.

If the component exits with an exit code listed in codes or is terminated on a signal listed in codes, pies executes actions specified in that ‘return-code’ block. The actions are executed in the order of their appearance below:

Config: return-code: exec command

Execute the supplied external command. Prior to execution, all file descriptors are closed. The command inherits the environment from the main pies process with the following additional variables:

PIES_VERSION

The pies version number (1.8).

PIES_MASTER_PID

PID of the master pies process.

PIES_COMPONENT

Tag of the terminated component (see tag).

PIES_PID

PID of the terminated component.

PIES_SIGNAL

If the component terminated on signal, the number of that signal.

PIES_STATUS

Program exit code.

Config: return-code: action disable | restart

If ‘restart’ is given, restart the component. This is the default. Otherwise, mark the component as disabled. Component dependents are stopped and marked as disabled as well. Once disabled, the components are never restarted, unless their restart is requested by the administrator.

Config: return-code: notify email-string

Send an email notification to addresses in email-string. See Notification, for a detailed discussion of this feature.

Config: return-code: message string

Supply notification message text to use by notify statement. See Notification, for a detailed discussion of this feature.

Any number of return-code statements are allowed, provided that their codes do not intersect.

The return-code statements can also be used outside of component block. In this case, they supply global actions, i.e. actions applicable to all components. Any return-code statements appearing within a component block override the global ones.


Next: , Previous: , Up: Component Statement   [Contents][Index]