📄 shut_down
字号:
#!/bin/sh5########################################################################## Copyright (c) 1988, 1989 by# Digital Equipment Corporation, Maynard, MA# All rights reserved.## This software is furnished under a license and may be used and# copied only in accordance with the terms of such license and# with the inclusion of the above copyright notice. This# software or any other copies thereof may not be provided or# otherwise made available to any other person. No title to and# ownership of the software is hereby transferred. ## The information in this software is subject to change without# notice and should not be construed as a commitment by Digital# Equipment Corporation. ## Digital assumes no responsibility for the use or reliability# of its software on equipment which is not supplied by Digital.## SCCSID = "@(#)shut_down 4.1 (ULTRIX) 7/27/90"## 000 Jonathan Wallace 1-Jun-1990###########################################################################trap 'exit' 1 2 3 18LL=""FLAG=$1case $FLAG in-r ) PROCEDURE_NAME="*** System Reboot Procedure ***" COMMAND1="reboot" COMMAND2="reboot" ;;* ) PROCEDURE_NAME="*** System Shutdown Procedure ***" COMMAND1="shutdown" COMMAND2="shut down" ;;esacclearwhile truedo while true do echo "$PROCEDURE_NAMEHow many minutes delay do you want until system ${COMMAND1}? [1]: \c" read DELAY case $DELAY in "" ) DELAY="+1" ;; [1-9] | [1-9][0-9] | [1-9][0-9][0-9] ) DELAY="+$DELAY" ;; * ) clear echo "Sorry, '$DELAY' is not a valid response." continue ;; esac break done echo "If you want a message displayed to users explaining the reasonfor the system shutdown, enter it below. The message text islimited to one line. Type <RETURN> without typing a messageif you do not want a shutdown message displayed:" read MESSAGE while true do echo "Are you sure you want to ${COMMAND2} the system? (y/n) [n]: \c" read resp case $resp in "" | [Nn]* ) echo "${LL}${LL}System will not be shut down!" echo "${LL}Press <RETURN> to continue: \c" read resp break 2 ;; [Yy]* ) echo "${LL}${LL}SYSTEM SHUTDOWN PROCESS INVOKED!" /etc/shutdown $FLAG $DELAY "$MESSAGE" case $? in 0 ) ;; * ) echo "ERROR trying to invoke /etc/shutdown command." echo "System will not be shut down!" ;; esac echo "${LL}Press <RETURN> to continue: \c" read resp break 2 ;; * ) ;; esac donedone
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -