1.\" $OpenBSD: rc.shutdown.8,v 1.13 2011/07/08 02:14:13 ajacoutot 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: July 8 2011 $ 28.Dt RC.SHUTDOWN 8 29.Os 30.Sh NAME 31.Nm rc.shutdown 32.Nd command script run at system shutdown 33.Sh SYNOPSIS 34.Nm /etc/rc.shutdown 35.Sh DESCRIPTION 36When the system is shut down using the 37.Xr reboot 8 38or 39.Xr halt 8 40commands, 41or when 42.Xr init 8 43is signalled to do so, 44or when a keyboard-requested halt is issued (if the architecture supports it), 45.Xr rc 8 46is invoked with the argument 47.Dq shutdown . 48This document details the actions taken by 49.Xr rc 8 50in such an instance. 51.Pp 52Firstly it saves random data for reseeding the kernel random number 53generator during the next boot. 54It then stops any daemons 55defined in the 56.Va pkg_scripts 57variable in 58.Xr rc.conf.local 8 , 59by passing them the 60.Cm stop 61argument. 62.Pp 63.Xr rc 8 64then runs 65.Nm . 66The administrator should place in this file 67any commands they wish to have executed during shutdown. 68.Pp 69Finally, all 70.Xr carp 4 71interfaces are brought down and then the system shuts down. 72If 73.Nm 74has the variable 75.Va powerdown 76set to 77.Dq YES , 78the machine will attempt to power off after it has halted. 79.Pp 80If 81.Xr init 8 82is exiting single-user mode it will also run the first part of shutdown 83(saving random data), 84though not the latter. 85.Sh SEE ALSO 86.Xr init 8 , 87.Xr rc 8 , 88.Xr rc.conf 8 , 89.Xr reboot 8 90