Mercurial > vanilla
comparison core/rc/rc.shutdown @ 566:ddb052f876cd
core/rc: move etc services to rc, closes #1666
author | David Demelier <markand@malikania.fr> |
---|---|
date | Fri, 05 Jul 2019 20:58:54 +0200 |
parents | core/etc/rc.shutdown@79f1635bda5f |
children | dbd752e285f6 |
comparison
equal
deleted
inserted
replaced
565:15992f10ced3 | 566:ddb052f876cd |
---|---|
1 #!/bin/sh | |
2 # | |
3 # /etc/rc.shutdown: reboot and halt script | |
4 # | |
5 # Copyright (c) 2019 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 if [ -f /etc/rc.conf ]; then | |
21 source /etc/rc.conf | |
22 fi | |
23 | |
24 echo "Terminating all processes." | |
25 /bin/killall5 -15 | |
26 | |
27 echo "Unmounting all filesystems." | |
28 /bin/halt -w | |
29 /bin/swapoff -a | |
30 | |
31 echo "Remounting / read-only" | |
32 /bin/umount -a -d -r -t nosysfs,noproc,nodevtmpfs | |
33 /bin/umount -a -r | |
34 /bin/mount -o remount,ro / | |
35 | |
36 if [ "$1" = "0" ]; then | |
37 /bin/poweroff -d -f -i | |
38 else | |
39 /bin/reboot -d -f -i | |
40 fi |