File: 3

package info (click to toggle)
runit 2.2.0-7
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 2,568 kB
  • sloc: ansic: 6,071; sh: 3,419; makefile: 399
file content (29 lines) | stat: -rwxr-xr-x 755 bytes parent folder | download | duplicates (2)
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
#!/bin/sh
exec 2>&1

PATH=/usr/sbin:/sbin:/usr/bin:/bin
export PATH

LAST=0

# While test -x is more natural, it does not consider file with
# executable bit set on 'noexec' filesystem as executable, and /run
# often is mounted as 'noexec'.
[ $(stat -c %a /run/runit.reboot) = 100 ] && LAST=6
# used by /sbin/runlevel
printf "$LAST" >/run/runit.runlevel

[ -x /etc/runit/rc.shutdown ] && /etc/runit/rc.shutdown

echo 'Waiting for services to stop...'
sv -w 25 force-stop /etc/service/*
sv exit /etc/service/*

echo 'Running shutdown tasks...'
if [ -f /etc/runit/native.boot.run ] && [ -d /etc/runit/shutdown-run ]; then
		for f in /etc/runit/shutdown-run/*.sh; do
			[ -r "$f" ] && . "$f"
		done
else
	/lib/runit/run_sysv_scripts "/etc/rc$LAST.d" stop
fi