📄 common_script
字号:
#!/bin/bash# This is a generic start/stop/restart/status script. Use environment# variables to configure it for a particular daemon. This script relies on# .pid files to determine whether the daemon is already running.# The following are used by many of the startup scripts in this distro, but we# don't currently use them in this simple script.# . /etc/sysconfig/rc# . $rc_functions# . /etc/sysconfig/network# Configuration for this script is provided by the following environment# variables. See ./ladd or ./snmpd for examples.# START_CMD# PID_FILE# STARTING_MSG# STOPPING_MSG# NOT_RUNNING_MSG# RUNNING_MSG# USAGE_MSGcase "$1" in start) if [ -f $PID_FILE ]; then PID=$(cat $PID_FILE) if [ -d /proc/$PID ]; then echo -n $RUNNING_MSG echo -n -e "\040" # Force space before PID. echo $PID else echo $STARTING_MSG $START_CMD fi else echo $STARTING_MSG $START_CMD fi ;; stop) if [ -f $PID_FILE ]; then PID=$(cat $PID_FILE) if [ -d /proc/$PID ]; then echo $STOPPING_MSG kill $PID # Use "-f" since the process may have already removed the PID file # on termination. rm -f $PID_FILE else echo $NOT_RUNNING_MSG fi else echo $NOT_RUNNING_MSG fi ;; restart) $0 stop sleep 1 $0 start ;; status) if [ -f $PID_FILE ]; then PID=$(cat $PID_FILE) if [ -d /proc/$PID ]; then echo -n $RUNNING_MSG echo -n -e "\040" # Force space before PID. echo $PID else echo $NOT_RUNNING_MSG fi else echo $NOT_RUNNING_MSG fi ;; *) echo "Usage: $0 {start|stop|restart|status}" exit 1 ;;esac
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -