优化了项目所需要的软件启动和关闭脚本

This commit is contained in:
lsy
2017-10-04 16:24:16 +08:00
parent b4d2c4052c
commit fe0af0804f
15 changed files with 134 additions and 7 deletions
+5
View File
@@ -0,0 +1,5 @@
#!/usr/bin/env bash
source lib/execTemplate.sh
startTemplate activemq start ${activemqPath} start
+5 -4
View File
@@ -1,5 +1,6 @@
#!/usr/bin/env bash
echo "准备关闭activemq服务"
cd /opt/tools/apache-activemq-5.15.0/bin
./activemq stop
echo "activemq服务关闭完毕"
source lib/execTemplate.sh
stopTemplate activemq stop ${activemqPath} stop
+8
View File
@@ -0,0 +1,8 @@
#!/usr/bin/env bash
# 用于配置程序的启动路径
nginxPath="/usr/local/nginx/sbin/nginx"
activemqPath="/opt/tools/apache-activemq-5.15.0/bin/activemq"
fastdfs_trackerd_Path="/usr/bin/fdfs_trackerd"
fastdfs_trackerd_conf_Path="/etc/fdfs/tracker.conf"
fastdfs_storaged_Path="/usr/bin/fdfs_storaged"
fastdfs_storaged_conf_Path="/etc/fdfs/storage.conf"
+6
View File
@@ -0,0 +1,6 @@
#!/usr/bin/env bash
# 开启shipyarnf服务
echo "准备开始"
curl -sSL https://shipyard-project.com/deploy | PORT=7079 bash -s
echo "开启成功"
+1
View File
@@ -0,0 +1 @@
REDIS0006˙ÜłCđZÜňV
+10
View File
@@ -0,0 +1,10 @@
#!/usr/bin/env bash
source lib/execTemplate.sh
startTemplate fdfs_trackerd start ${fastdfs_trackerd_Path} ${fastdfs_trackerd_conf_Path}
startTemplate fdfs_storaged start ${fastdfs_storaged_Path} ${fastdfs_storaged_conf_Path}
+32
View File
@@ -0,0 +1,32 @@
#!/usr/bin/env bash
source lib/isOK.sh
source lib/isRunning.sh
source lib/isHaveAndBinPathTrue.sh
source config/devBinPath.sh
# 某个某个程序要执行开始操作的模板
# $1 进程名称 $2 自定义要执行的操作名 $3 bin路径  $4 启动参数 $5 配置文件路径
function startTemplate(){
isBinPathTrue $3 $1
if [ $? -eq 0 ]; then
isRunning $1
if [ $? -ne 0 ];then
$3 $4 $5
isOk $1 $2 $?
fi
fi
}
# 某个某个进程要执行关闭操作的模板
# $1 进程名称 $2 自定义要执行的操作名 $3 bin路径  $4 启动参数 $5 配置文件路径
function stopTemplate(){
isBinPathTrue $3 $1
if [ $? -eq 0 ]; then
isRunning $1
if [ $? -eq 0 ];then
$3 $4 $5
isOk $1 $2 $?
fi
fi
}
+11
View File
@@ -0,0 +1,11 @@
#!/usr/bin/env bash
# 检测文件是否存在并且是可执行的文件 $1 要检测的路径 $2 检测的程序名称
function isBinPathTrue(){
if [ -x $1 ]; then
printf "%s是可执行文件\n" "$1"
return 0
else
printf "%s没有安装或者没有安装在本项目约定的位置\n如果确定安装了%s请修改config/binPath下的对应启动路径\n" "$2$2"
return 1
fi
}
+12
View File
@@ -0,0 +1,12 @@
#!/usr/bin/env bash
# 根据输入的对程序的操作以及操作的返回结果来进行提示
# $1 操作的程序名称 $2 对程序进行的操作 $3 操作的返回结果值
function isOk(){
if [ $3 -eq 0 ];then
printf "%s %s successful\n" "$1 $2"
return 0
else
printf "%s %s fail\n" "$1 $2"
return 1
fi
}
+13
View File
@@ -0,0 +1,13 @@
#!/usr/bin/env bash
# $1 要检测的进程的名字
function isRunning(){
ps -fe|grep $1|grep -v grep|grep -v $0
if [ $? -eq 0 ]
then
printf "%s is Running\n" "$1"
return 0
else
printf "%s is not Running\n" "$1"
return 1
fi
}
+9
View File
@@ -0,0 +1,9 @@
#!/usr/bin/env bash
source lib/execTemplate.sh
startTemplate nginx test ${nginxPath} -t
startTemplate nginx start ${nginxPath}
+10
View File
@@ -0,0 +1,10 @@
#!/usr/bin/env bash
source lib/execTemplate.sh
stopTemplate nginx stop ${nginxPath} "-s stop"
+4
View File
@@ -0,0 +1,4 @@
#!/usr/bin/env bash
source lib/isOK.sh
redis-server
isOk vsftpd start $?
+6
View File
@@ -0,0 +1,6 @@
#!/usr/bin/env bash
source lib/isOK.sh
systemctl start vsftpd
isOk vsftpd start $?
+2 -3
View File
@@ -1,5 +1,4 @@
#!/usr/bin/env bash
#!/usr/bin/env bash
echo "正在关闭vsftpd服务"
source lib/isOK.sh
systemctl stop vsftpd
echo "vsftpd服务关闭成功"
isOk vsftpd stop $?