File: heart.3

package info (click to toggle)
erlang-manpages 1%3A12.b.3-1
  • links: PTS
  • area: main
  • in suites: lenny
  • size: 4,188 kB
  • ctags: 2
  • sloc: makefile: 68; perl: 30; sh: 15
file content (72 lines) | stat: -rw-r--r-- 3,345 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
.TH heart 3 "kernel  2.12.3" "Ericsson AB" "ERLANG MODULE DEFINITION"
.SH MODULE
heart \- Heartbeat Monitoring of an Erlang Runtime System
.SH DESCRIPTION
.LP
This modules contains the interface to the \fIheart\fR process\&. \fIheart\fR sends periodic heartbeats to an external port program, which is also named \fIheart\fR\&. The purpose of the heart port program is to check that the Erlang runtime system it is supervising is still running\&. If the port program has not received any heartbeats within \fIHEART_BEAT_TIMEOUT\fR seconds (default is 60 seconds), the system can be rebooted\&. Also, if the system is equipped with a hardware watchdog timer and is running Solaris, the watchdog can be used to supervise the entire system\&.
.LP
An Erlang runtime system to be monitored by a heart program, should be started with the command line flag \fI-heart\fR (see also erl(1)\&. The \fIheart\fR process is then started automatically:

.nf
% erl -heart \&.\&.\&.

.fi
.LP
If the system should be rebooted because of missing heart-beats, or a terminated Erlang runtime system, the environment variable \fIHEART_COMMAND\fR has to be set before the system is started\&. If this variable is not set, a warning text will be printed but the system will not reboot\&. However, if the hardware watchdog is used, it will trigger a reboot \fIHEART_BEAT_BOOT_DELAY\fR seconds later nevertheless (default is 60)\&.
.LP
To reboot on the WINDOWS platform \fIHEART_COMMAND\fR can be set to \fIheart -shutdown\fR (included in the Erlang delivery) or of course to any other suitable program which can activate a reboot\&.
.LP
The hardware watchdog will not be started under Solaris if the environment variable \fIHW_WD_DISABLE\fR is set\&.
.LP
The \fIHEART_BEAT_TIMEOUT\fR and \fIHEART_BEAT_BOOT_DELAY\fR environment variables can be used to configure the heart timeouts, they can be set in the operating system shell before Erlang is started or be specified at the command line:

.nf
% erl -heart -env HEART_BEAT_TIMEOUT 30 \&.\&.\&.

.fi
.LP
The value (in seconds) must be in the range 10 < X <= 65535\&.
.LP
It should be noted that if the system clock is adjusted with more than \fIHEART_BEAT_TIMEOUT\fR seconds, \fIheart\fR will timeout and try to reboot the system\&. This can happen, for example, if the system clock is adjusted automatically by use of NTP (Network Time Protocol)\&.
.LP
In the following descriptions, all function fails with reason \fIbadarg\fR if \fIheart\fR is not started\&.

.SH EXPORTS
.LP
.B
set_cmd(Cmd) -> ok | {error, {bad_cmd, Cmd}}
.br
.RS
.TP
Types
Cmd = string()
.br
.RE
.RS
.LP
Sets a temporary reboot command\&. This command is used if a \fIHEART_COMMAND\fR other than the one specified with the environment variable should be used in order to reboot the system\&. The new Erlang runtime system will (if it misbehaves) use the environment variable \fIHEART_COMMAND\fR to reboot\&.
.LP
Limitations: The length of the \fICmd\fR command string must be less than 2047 characters\&.
.RE
.LP
.B
clear_cmd() -> ok
.br
.RS
.LP
Clears the temporary boot command\&. If the system terminates, the normal \fIHEART_COMMAND\fR is used to reboot\&.
.RE
.LP
.B
get_cmd() -> {ok, Cmd}
.br
.RS
.TP
Types
Cmd = string()
.br
.RE
.RS
.LP
Get the temporary reboot command\&. If the command is cleared, the empty string will be returned\&.
.RE