1 Star 0 Fork 2

狂奔的蜗牛. / bashtools

forked from Erasin / bashtools 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
rcd.sh 775 Bytes
一键复制 编辑 原始数据 按行查看 历史
Erasin 提交于 2013-09-18 09:26 . init
#!/bin/bash
#print
usage(){
local name=${0##*/}
cat >&2 <<EOF
usage: $name <action> daemons option
option:
start
restart
stop
EOF
}
(( $# < 1 )) && usage
if [[ $# -ge 2 ]];then
mod=$1
action=$2
elif [[ $# -eq 1 ]];then
mod=$1
read -p "输入对"$1"的操作[start|restart|stop]:" action
elif [[ $# -eq 0 ]];then
read -p "输入操作对象:" mod
read -p " 输入操作[start|restart|stop]" action
fi
if [[ `ls /etc/rc.d/|grep "^$mod"` ]]; then
echo "开始对$mod操作!"
else
echo "没有$mod,Quit!"
exit
fi
if [[ "$action" -eq "start" || "$action" -eq "restart" || "$action" -eq "stop" ]]; then
echo "开始对$mod进行$action操作!"
echo "/etc/rc.d/"$mod $action
sudo "/etc/rc.d/"$mod $action
else
echo "没有$action操作!Quit!"
exit
fi
1
https://gitee.com/snail/bashtools.git
git@gitee.com:snail/bashtools.git
snail
bashtools
bashtools
master

搜索帮助