Mercurial > vinit
comparison vinit.shutdown @ 4:3db6ca1fe07d
misc: merge scripts from vinit-script
While here, make /etc tunable.
author | David Demelier <markand@malikania.fr> |
---|---|
date | Wed, 10 Nov 2021 16:34:41 +0100 |
parents | |
children | 7d40d4ae7377 |
comparison
equal
deleted
inserted
replaced
3:55c59f0c8cbd | 4:3db6ca1fe07d |
---|---|
1 #!/bin/sh | |
2 # | |
3 # @SYSCONFDIR@/rc.shutdown -- reboot and halt script | |
4 # | |
5 # Copyright (c) 2019-2021 David Demelier <markand@malikania.fr> | |
6 # | |
7 # Permission to use, copy, modify, and/or distribute this software for any | |
8 # purpose with or without fee is hereby granted, provided that the above | |
9 # copyright notice and this permission notice appear in all copies. | |
10 # | |
11 # THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES | |
12 # WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF | |
13 # MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR | |
14 # ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES | |
15 # WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN | |
16 # ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | |
17 # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | |
18 # | |
19 | |
20 trap "" INT TERM | |
21 | |
22 if [ -f @SYSCONFDIR@/vinit.conf ]; then | |
23 . @SYSCONFDIR@/vinit.conf | |
24 fi | |
25 | |
26 # Stop networking. | |
27 if [ -x @SYSCONFDIR@/vinit.net ]; then | |
28 @SYSCONFDIR@/vinit.net stop | |
29 fi | |
30 | |
31 echo "Terminating all processes." | |
32 killall5 -15 | |
33 | |
34 echo "Unmounting all filesystems." | |
35 halt -w | |
36 swapoff -a | |
37 | |
38 echo "Remounting / read-only" | |
39 umount -a -d -r -t nosysfs,noproc,nodevtmpfs | |
40 umount -a -r | |
41 mount -o remount,ro / | |
42 | |
43 case "$1" in | |
44 "halt") | |
45 halt -f ;; | |
46 "poweroff") | |
47 poweroff -f ;; | |
48 "reboot") | |
49 reboot -f ;; | |
50 esac |