summaryrefslogtreecommitdiff
path: root/downtimed.8
blob: 5c9d4a53fed9da829dd28877efcfd8463122beac (plain)
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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
.\"-
.\" Copyright (c) 2009-2016 Janne Snabb. All rights reserved.
.\"
.\" This software is licensed under the terms and conditions of the
.\" Simplified BSD License. You should have received a copy of that
.\" license along with this software.
.\"
.TH DOWNTIMED 8 "2016-05-24" "version 1.0"
.SH NAME
downtimed \- system downtime monitoring and reporting daemon
.SH SYNOPSIS
.B downtimed
.RB [\| \-D \|]
.RB [\| \-d
.IR datadir \|]
.RB [\| \-F \|]
.RB [\| \-f
.IR timefmt \|]
.RB [\| \-l
.IR log \|]
.RB [\| \-p
.IR pidfile \|]
.RB [\| \-S \|]
.RB [\| \-s
.IR sleep \|]
.br
.B downtimed
.B \-v
.SH DESCRIPTION
The
.B downtimed
daemon waits in the background, frequently updating a time stamp file
on the disk. If the daemon is killed with a signal associated with a
normal system shutdown procedure, it records the shutdown time on
the disk.
.PP
When the daemon is restarted during the next boot process,
it reports how long the system was down and whether it was properly
shut down or crashed. The downtime report is output to the system log
or to a specified log file. Also a record is appended to the downtime
database.
.SH OPTIONS
.TP
.B \-D
Do not create nor update the downtime database.
.TP
.B \-d \fIdatadir\fR
The directory where the time stamp files as well as the downtime database
are located. The default directory is determined at compile time.
.TP
.B \-F
Do not call
.BR daemon (3)
to
.BR fork (2)
to background. Useful with modern system service managers such as
.BR systemd (8) ,
.BR launchd (8)
and others.
.TP
.B \-f \fItimefmt\fR
Specify the time and date format to use when reporting using
.BR strftime (3)
syntax. The default is "%F %T".
.TP
.B \-l \fIlog\fR
Logging destination. If the argument contains a slash (/) it is interpreted
to be a path name to a log file, which will be created if it does not exist
already. Otherwise it is interpreted as a syslog facility name. The
default logging destination is "daemon" which means that the messages
are written to syslog with the daemon facility code.
.TP
.B \-p \fIpidfile\fR
The location of the file which keeps track of the process ID of the
running daemon process. The system default location is determined at
compile time. May be disabled by specifying "none".
.TP
.B \-S
Normally
.BR fsync (2)
is performed after each update of the time stamp. This option disables the
.BR fsync (2).
It reduces the load on the disk system but makes the downtime
measurement less reliable.
.TP
.B \-s \fIsleep\fR
Defines how long to sleep between each update of the on\-disk time
stamp file. More frequent updates result in more accurate downtime
reporting in the case of a system crash. Less frequent updates decrease
the amount of disk writes performed. The default is to sleep 15 seconds
between each update. If you are using a flash memory based SSD or other
disk which has limited amount of write cycles per block, it might be a
good idea to set the sleep time to a higher value to prolong the
lifetime of the storage device.
.TP
.B \-v
Display the program version number, copyright message and the default
settings.
.SH SIGNALS
.TP
.B SIGHUP
Close and re-open the output log. Use in case you want to rotate
the log file.
.TP
.B SIGTERM and SIGINT
Terminate gracefully. These signals signify that a graceful system
shutdown is in process.
.SH EXIT STATUS
The daemon exits 0 on success, and >0 if an error occurs.
.SH SEE ALSO
.\".BR downtime (1),
.BR downtimes (1),
.BR syslog.conf (5),
.ie !d pdfhref \
https://dist.epipe.com/downtimed/
.el \
.pdfhref W https://dist.epipe.com/downtimed/
.SH BUGS
The reporting accuracy in case of a system crash depends on how often the
time stamp is updated.
.PP
Finding out the system startup time is very operating system specific.
If the program does not have specific code to support your operating
system, it assumes that the system started when the daemon started.
.PP
Reporting is inaccurate if the system clock changes during system
downtime or startup process. Daylight saving time changes have no
effect as all calculations are done using UTC.
.SH COPYRIGHT
Copyright \(co 2009\-2016 Janne Snabb. All rights reserved.
.PP
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
.PP
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
.PP
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
.PP
THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
SUCH DAMAGE.
.\" eof