Next: Output Redirectors, Previous: Actions Before Startup, Up: Component Statement [Contents][Index]
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:
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:
Name | Numeric value |
---|---|
EX_OK | 0 |
EX_USAGE | 64 |
EX_DATAERR | 65 |
EX_NOINPUT | 66 |
EX_NOUSER | 67 |
EX_NOHOST | 68 |
EX_UNAVAILABLE | 69 |
EX_SOFTWARE | 70 |
EX_OSERR | 71 |
EX_OSFILE | 72 |
EX_CANTCREAT | 73 |
EX_IOERR | 74 |
EX_TEMPFAIL | 75 |
EX_PROTOCOL | 76 |
EX_NOPERM | 77 |
EX_CONFIG | 78 |
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:
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.
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.
Send an email notification to addresses in email-string. See Notification, for a detailed discussion of this feature.
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: Output Redirectors, Previous: Actions Before Startup, Up: Component Statement [Contents][Index]