blob: 219e775166b8d3da5d7b5a55dbca46ab1ad5ce2e (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
|
#!/bin/sh
# shellcheck disable=1090,1091
. /etc/init/rc.conf
. /usr/lib/init/rc.lib
PATH=$PATH:/usr/local/bin:/usr/bin
run_hook pre.shutdown
command -v sv >/dev/null &&
out "Waiting for runit services to stop..."; {
sv -w196 force-stop /var/service/* >/dev/null
sv exit /var/service/* >/dev/null
}
command -v svctl >/dev/null &&
out "Waiting for sysmgr services to stop..."; {
svctl kill /var/sysmgr/* 2>/dev/null
}
# Save random seed
random save
out "Sending TERM signal to all processes..."; {
killall5 -TERM
sleep 1
}
out "Sending KILL signal to all processes..."; {
killall5 -KILL
}
out "Unmounting filesystems and disabling swap..."
out "Remounting rootfs as readonly"; {
swapoff -a
umount -rat nosysfs,noproc,nodevtmpfs,notmpfs
mount -o remount,ro /
sync
}
run_hook post.shutdown
case "$1" in reboot) shalt r ;; poweroff) shalt p; esac
|