📄 restart.sh
字号:
#!/bin/shif [ -z "$1" ]; then /bin/echo "$0 <command line>" exit 1fiparam=''list='2 3 4 5 6 7 8 9'for i in $list; do eval p='$'$i if [ -z $p ]; then break fi param="$param $p"doneif [ -f /bin/awk ]; then AWK=/bin/awkelse AWK=/usr/bin/awkfiif [ -f /bin/grep ]; then GREP=/bin/grepelse GREP=/usr/bin/grepfiif [ -f /bin/expr ]; then EXPR=/bin/exprelse EXPR=/usr/bin/exprfiprogram=`/bin/echo $1 | $AWK -F '/' '{print $NF;}'`count=`/bin/ps auxww | $GREP -w $program | $GREP -v grep | /usr/bin/wc -l`if [ $count -gt 0 ]; then i=0 /bin/echo "stopping $program ..." while [ 1 -eq 1 ]; do if [ $i -eq 0 ]; then /usr/bin/killall $program else /usr/bin/killall $program >/dev/null 2>&1 fi if [ $? -ne 0 ]; then break fi /usr/bin/printf . /bin/sleep 1 i=`$EXPR $i + 1` donefi/bin/echo ""count=`/bin/ps auxww | $GREP -w $program | $GREP -v grep | $GREP -v $0 | /usr/bin/wc -l`if [ $count -eq 0 ]; then /bin/echo "starting $program ..." exec $1 $paramelse /bin/ps auxww | $GREP -w $program | $GREP -v grep | $GREP -v $0 /bin/echo "already running $program count: $count, restart aborted!"fi
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -