1.\" $OpenBSD: rc.shutdown.8,v 1.16 2020/05/16 16:58:12 jmc 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: May 16 2020 $ 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 , 57by passing them the 58.Cm stop 59argument. 60.Pp 61.Xr rc 8 62then runs 63.Nm . 64The administrator should place in this file 65any commands they wish to have executed during shutdown. 66.Pp 67Finally, all 68.Xr carp 4 69interfaces are brought down and then the system shuts down. 70.Pp 71If 72.Xr init 8 73is exiting single-user mode it will also run the first part of shutdown 74(saving random data), 75though not the latter. 76.Sh FILES 77.Bl -tag -width "/etc/rc.shutdown" 78.It Pa /etc/rc.shutdown 79Command script run at system shutdown. 80.It Pa /etc/examples/rc.shutdown 81Example script. 82.El 83.Sh SEE ALSO 84.Xr init 8 , 85.Xr rc 8 , 86.Xr rc.conf 8 , 87.Xr reboot 8 88