#!/bin/sh #-------------------------------------------------- #Author: Created by randolph 2016/10/21 #Blog:http://randolph.blog.51cto.com #Function: This scripts function is create|remove #Version:4.1.2 #-------------------------------------------------- . /etc/init.d/functions _PATH=/tmp/start read -t 12 -p "Please input a string:{start|stop|restart}: " STRING function start(){ if [ -f $_PATH ]; then echo "File is exist." else /bin/touch $_PATH action "Create a file successfully..." /bin/true fi } function stop(){ if [ -f $_PATH ]; then /bin/rm -fr $_PATH action "Remove file successfully..." /bin/true else echo "File no exist." action "Remove file fail..." /bin/false fi } case $STRING in start) start ;; stop) stop ;; restart) stop start ;; *) echo echo -e "\033[31;5m $0 Usage:{start|stop|restar}\033[0m" echo ;; esac
时间: 2024-10-06 10:38:06