xref: /openbsd-src/share/man/man8/rc.shutdown.8 (revision a24e0b21db04d3a66e5dd23eb6b3f376db0aff0d)
1.\"	$OpenBSD: rc.shutdown.8,v 1.17 2024/09/15 19:39:26 kn Exp $
2.\"
3.\" Copyright (c) 1999 Aaron Campbell
4.\" All rights reserved.
5.\"
6.\" Redistribution and use in source and binary forms, with or without
7.\" modification, are permitted provided that the following conditions
8.\" are met:
9.\"
10.\" 1. Redistributions of source code must retain the above copyright
11.\"    notice, this list of conditions and the following disclaimer.
12.\" 2. Redistributions in binary form must reproduce the above copyright
13.\"    notice, this list of conditions and the following disclaimer in the
14.\"    documentation and/or other materials provided with the distribution.
15.\"
16.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
17.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
18.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
19.\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
20.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
21.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
22.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
23.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
25.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26.\"
27.Dd $Mdocdate: September 15 2024 $
28.Dt RC.SHUTDOWN 8
29.Os
30.Sh NAME
31.Nm rc.shutdown
32.Nd command script run at system shutdown
33.Sh DESCRIPTION
34When the system is shut down using the
35.Xr reboot 8
36or
37.Xr halt 8
38commands,
39or when
40.Xr init 8
41is signalled to do so,
42or when a keyboard-requested halt is issued (if the architecture supports it),
43.Xr rc 8
44is invoked with the argument
45.Dq shutdown .
46This document details the actions taken by
47.Xr rc 8
48in such an instance.
49.Pp
50Firstly it saves random data for reseeding the kernel random number
51generator during the next boot.
52It then stops any daemons
53defined in the
54.Va pkg_scripts
55variable in
56.Xr rc.conf.local 8 ,
57as well as
58.Xr vmd 8 ,
59in that order,
60by passing them the
61.Cm stop
62argument.
63.Pp
64.Xr rc 8
65then runs
66.Nm .
67The administrator should place in this file
68any commands they wish to have executed during shutdown.
69.Pp
70Finally, all
71.Xr carp 4
72interfaces are brought down and then the system shuts down.
73.Pp
74If
75.Xr init 8
76is exiting single-user mode it will also run the first part of shutdown
77(saving random data),
78though not the latter.
79.Sh FILES
80.Bl -tag -width "/etc/rc.shutdown"
81.It Pa /etc/rc.shutdown
82Command script run at system shutdown.
83.It Pa /etc/examples/rc.shutdown
84Example script.
85.El
86.Sh SEE ALSO
87.Xr init 8 ,
88.Xr rc 8 ,
89.Xr rc.conf 8 ,
90.Xr reboot 8
91