1
<?xml version="1.0" encoding="latin1" ?>
2
<!DOCTYPE erlref SYSTEM "erlref.dtd">
9
<holder>Ericsson AB, All Rights Reserved</holder>
12
The contents of this file are subject to the Erlang Public License,
13
Version 1.1, (the "License"); you may not use this file except in
14
compliance with the License. You should have received a copy of the
15
Erlang Public License along with this software. If not, it can be
16
retrieved online at http://www.erlang.org/.
18
Software distributed under the License is distributed on an "AS IS"
19
basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
20
the License for the specific language governing rights and limitations
23
The Initial Developer of the Original Code is Ericsson AB.
27
<prepared>Magnus Fröberg</prepared>
29
<date>1998-01-28</date>
32
<module>heart</module>
33
<modulesummary>Heartbeat Monitoring of an Erlang Runtime System</modulesummary>
35
<p>This modules contains the interface to the <c>heart</c> process.
36
<c>heart</c> sends periodic heartbeats to an external port
37
program, which is also named <c>heart</c>. The purpose of
38
the heart port program is to check that the Erlang runtime system
39
it is supervising is still running. If the port program has not
40
received any heartbeats within <c>HEART_BEAT_TIMEOUT</c> seconds
41
(default is 60 seconds), the system can be rebooted. Also, if
42
the system is equipped with a hardware watchdog timer and is
43
running Solaris, the watchdog can be used to supervise the entire
45
<p>An Erlang runtime system to be monitored by a heart program,
46
should be started with the command line flag <c>-heart</c> (see
47
also <seealso marker="erts:erl">erl(1)</seealso>. The <c>heart</c>
48
process is then started automatically:</p>
50
% <input>erl -heart ...</input></pre>
51
<p>If the system should be rebooted because of missing heart-beats,
52
or a terminated Erlang runtime system, the environment variable
53
<c>HEART_COMMAND</c> has to be set before the system is started.
54
If this variable is not set, a warning text will be printed but
55
the system will not reboot. However, if the hardware watchdog is
56
used, it will trigger a reboot <c>HEART_BEAT_BOOT_DELAY</c>
57
seconds later nevertheless (default is 60).</p>
58
<p>To reboot on the WINDOWS platform <c>HEART_COMMAND</c> can be
59
set to <c>heart -shutdown</c> (included in the Erlang delivery)
60
or of course to any other suitable program which can activate a
62
<p>The hardware watchdog will not be started under Solaris if
63
the environment variable <c>HW_WD_DISABLE</c> is set.</p>
64
<p>The <c>HEART_BEAT_TIMEOUT</c> and <c>HEART_BEAT_BOOT_DELAY</c>
65
environment variables can be used to configure the heart timeouts,
66
they can be set in the operating system shell before Erlang is
67
started or be specified at the command line:</p>
69
% <input>erl -heart -env HEART_BEAT_TIMEOUT 30 ...</input></pre>
70
<p>The value (in seconds) must be in the range 10 < X <= 65535.</p>
71
<p>It should be noted that if the system clock is adjusted with
72
more than <c>HEART_BEAT_TIMEOUT</c> seconds, <c>heart</c> will
73
timeout and try to reboot the system. This can happen, for
74
example, if the system clock is adjusted automatically by use of
75
NTP (Network Time Protocol).</p>
76
<p>In the following descriptions, all function fails with reason
77
<c>badarg</c> if <c>heart</c> is not started.</p>
81
<name>set_cmd(Cmd) -> ok | {error, {bad_cmd, Cmd}}</name>
82
<fsummary>Set a temporary reboot command</fsummary>
87
<p>Sets a temporary reboot command. This command is used if
88
a <c>HEART_COMMAND</c> other than the one specified with
89
the environment variable should be used in order to reboot
90
the system. The new Erlang runtime system will (if it
91
misbehaves) use the environment variable
92
<c>HEART_COMMAND</c> to reboot.</p>
93
<p>Limitations: The length of the <c>Cmd</c> command string
94
must be less than 2047 characters.</p>
98
<name>clear_cmd() -> ok</name>
99
<fsummary>Clear the temporary boot command</fsummary>
101
<p>Clears the temporary boot command. If the system terminates,
102
the normal <c>HEART_COMMAND</c> is used to reboot.</p>
106
<name>get_cmd() -> {ok, Cmd}</name>
107
<fsummary>Get the temporary reboot command</fsummary>
109
<v>Cmd = string()</v>
112
<p>Get the temporary reboot command. If the command is cleared,
113
the empty string will be returned.</p>