1 #!/sbin/sh
2 #
3 # CDDL HEADER START
4 #
5 # The contents of this file are subject to the terms of the
6 # Common Development and Distribution License, Version 1.0 only
7 # (the "License"). You may not use this file except in compliance
8 # with the License.
9 #
10 # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
11 # or http://www.opensolaris.org/os/licensing.
12 # See the License for the specific language governing permissions
13 # and limitations under the License.
14 #
15 # When distributing Covered Code, include this CDDL HEADER in each
16 # file and include the License file at usr/src/OPENSOLARIS.LICENSE.
17 # If applicable, add the following below this CDDL HEADER, with the
18 # fields enclosed by brackets "[]" replaced with your own identifying
19 # information: Portions Copyright [yyyy] [name of copyright owner]
20 #
21 # CDDL HEADER END
22 #
23 # Copyright 2005 Sun Microsystems, Inc. All rights reserved.
24 # Use is subject to license terms.
25 #
26 # Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T
27 # All Rights Reserved
28
29
30
31 #ident "%Z%%M% %I% %E% SMI"
32
33 # Sequence performed to change the init state of a machine. Only allows
34 # transitions to states 0,1,5,6,s,S (i.e.: down or administrative states).
35
36 # This procedure checks to see if you are permitted and allows an
37 # interactive shutdown. The actual change of state, killing of
38 # processes and such are performed by the new init state, say 0,
39 # and its /sbin/rc0.
40
41 usage() {
42 echo "Usage: $0 [ -y ] [ -g<grace> ] [ -i<initstate> ] [ message ]"
43 exit 1
44 }
45
46 notify() {
47 /usr/sbin/wall -a <<-!
48 $*
49 !
50 if [ -x /usr/sbin/showmount -a -x /usr/sbin/rwall ]
51 then
52 remotes=`/usr/sbin/showmount`
122 echo "$0: $OPTARG is not a valid initstate"
123 usage
124 ;;
125 esac
126 ;;
127 y)
128 askconfirmation=
129 ;;
130 \?) usage
131 ;;
132 esac
133 done
134 shift `expr $OPTIND - 1`
135
136 echo '\nShutdown started. \c'
137 /usr/bin/date
138 echo
139
140 NODENAME=`uname -n`
141
142 /sbin/sync
143 cd /
144
145 trap "rm $nologin >/dev/null 2>&1 ;exit 1" 1 2 15
146
147 # If other users are on the system (and any grace period is given), warn them.
148
149 for i in 7200 3600 1800 1200 600 300 120 60 30 10; do
150 if [ ${grace} -gt $i ]
151 then
152 hours=`/usr/bin/expr ${grace} / 3600`
153 minutes=`/usr/bin/expr ${grace} % 3600 / 60`
154 seconds=`/usr/bin/expr ${grace} % 60`
155 time=""
156 if [ ${hours} -gt 1 ]
157 then
158 time="${hours} hours "
159 elif [ ${hours} -eq 1 ]
160 then
161 time="1 hour "
162 fi
|
1 #!/sbin/sh
2 #
3 # CDDL HEADER START
4 #
5 # The contents of this file are subject to the terms of the
6 # Common Development and Distribution License (the "License").
7 # You may not use this file except in compliance with the License.
8 #
9 # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10 # or http://www.opensolaris.org/os/licensing.
11 # See the License for the specific language governing permissions
12 # and limitations under the License.
13 #
14 # When distributing Covered Code, include this CDDL HEADER in each
15 # file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16 # If applicable, add the following below this CDDL HEADER, with the
17 # fields enclosed by brackets "[]" replaced with your own identifying
18 # information: Portions Copyright [yyyy] [name of copyright owner]
19 #
20 # CDDL HEADER END
21 #
22 # Copyright 2009 Sun Microsystems, Inc. All rights reserved.
23 # Use is subject to license terms.
24 #
25 # Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T
26 # All Rights Reserved
27
28
29
30 # Sequence performed to change the init state of a machine. Only allows
31 # transitions to states 0,1,5,6,s,S (i.e.: down or administrative states).
32
33 # This procedure checks to see if you are permitted and allows an
34 # interactive shutdown. The actual change of state, killing of
35 # processes and such are performed by the new init state, say 0,
36 # and its /sbin/rc0.
37
38 usage() {
39 echo "Usage: $0 [ -y ] [ -g<grace> ] [ -i<initstate> ] [ message ]"
40 exit 1
41 }
42
43 notify() {
44 /usr/sbin/wall -a <<-!
45 $*
46 !
47 if [ -x /usr/sbin/showmount -a -x /usr/sbin/rwall ]
48 then
49 remotes=`/usr/sbin/showmount`
119 echo "$0: $OPTARG is not a valid initstate"
120 usage
121 ;;
122 esac
123 ;;
124 y)
125 askconfirmation=
126 ;;
127 \?) usage
128 ;;
129 esac
130 done
131 shift `expr $OPTIND - 1`
132
133 echo '\nShutdown started. \c'
134 /usr/bin/date
135 echo
136
137 NODENAME=`uname -n`
138
139 cd /
140
141 trap "rm $nologin >/dev/null 2>&1 ;exit 1" 1 2 15
142
143 # If other users are on the system (and any grace period is given), warn them.
144
145 for i in 7200 3600 1800 1200 600 300 120 60 30 10; do
146 if [ ${grace} -gt $i ]
147 then
148 hours=`/usr/bin/expr ${grace} / 3600`
149 minutes=`/usr/bin/expr ${grace} % 3600 / 60`
150 seconds=`/usr/bin/expr ${grace} % 60`
151 time=""
152 if [ ${hours} -gt 1 ]
153 then
154 time="${hours} hours "
155 elif [ ${hours} -eq 1 ]
156 then
157 time="1 hour "
158 fi
|