File: shutdown

package info (click to toggle)
usermode 1.114-3
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 2,312 kB
  • sloc: ansic: 6,283; sh: 1,460; makefile: 129
file content (21 lines) | stat: -rwxr-xr-x 464 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#!/bin/sh
# Try to do the right thing for programs that rely on "/usr/bin/shutdown -r now"
# to shut down the machine.
prog=/sbin/shutdown
now=
for flag in $* ; do
	if test ${flag} = "-h" ; then
		prog=/usr/bin/halt
	elif test ${flag} = "-r" ; then
		prog=/usr/bin/reboot
	elif test ${flag} = "now" ; then
		now=$flag
	else
		args="$args $flag"
	fi
done
if [ -z "$args" -a $prog != /sbin/shutdown ] ; then
	exec $prog $args
else
	exec /sbin/shutdown $args $now
fi