diff --git a/all/bash/activemq_start.sh b/all/bash/activemq_start.sh new file mode 100644 index 0000000..763f5cd --- /dev/null +++ b/all/bash/activemq_start.sh @@ -0,0 +1,5 @@ +#!/usr/bin/env bash + +source lib/execTemplate.sh + +startTemplate activemq start ${activemqPath} start diff --git a/all/bash/activemq_stop.sh b/all/bash/activemq_stop.sh index 52ed3ca..022f5c3 100644 --- a/all/bash/activemq_stop.sh +++ b/all/bash/activemq_stop.sh @@ -1,5 +1,6 @@ #!/usr/bin/env bash -echo "准备关闭activemq服务" -cd /opt/tools/apache-activemq-5.15.0/bin -./activemq stop -echo "activemq服务关闭完毕" \ No newline at end of file + +source lib/execTemplate.sh + +stopTemplate activemq stop ${activemqPath} stop + diff --git a/all/bash/config/devBinPath.sh b/all/bash/config/devBinPath.sh new file mode 100644 index 0000000..22aa23e --- /dev/null +++ b/all/bash/config/devBinPath.sh @@ -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" \ No newline at end of file diff --git a/all/bash/docker_shipyarn_start.sh b/all/bash/docker_shipyarn_start.sh new file mode 100644 index 0000000..8661b7b --- /dev/null +++ b/all/bash/docker_shipyarn_start.sh @@ -0,0 +1,6 @@ +#!/usr/bin/env bash + +# 开启shipyarnf服务 +echo "准备开始" +curl -sSL https://shipyard-project.com/deploy | PORT=7079 bash -s +echo "开启成功" \ No newline at end of file diff --git a/all/bash/dump.rdb b/all/bash/dump.rdb new file mode 100644 index 0000000..56af04e --- /dev/null +++ b/all/bash/dump.rdb @@ -0,0 +1 @@ +REDIS0006ÿܳCðZÜòV \ No newline at end of file diff --git a/all/bash/fastdfs_start.sh b/all/bash/fastdfs_start.sh new file mode 100644 index 0000000..03c5444 --- /dev/null +++ b/all/bash/fastdfs_start.sh @@ -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} + + diff --git a/all/bash/lib/execTemplate.sh b/all/bash/lib/execTemplate.sh new file mode 100644 index 0000000..9ac11d3 --- /dev/null +++ b/all/bash/lib/execTemplate.sh @@ -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 +} diff --git a/all/bash/lib/isHaveAndBinPathTrue.sh b/all/bash/lib/isHaveAndBinPathTrue.sh new file mode 100644 index 0000000..0d30f17 --- /dev/null +++ b/all/bash/lib/isHaveAndBinPathTrue.sh @@ -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 +} diff --git a/all/bash/lib/isOK.sh b/all/bash/lib/isOK.sh new file mode 100644 index 0000000..82934db --- /dev/null +++ b/all/bash/lib/isOK.sh @@ -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 +} \ No newline at end of file diff --git a/all/bash/lib/isRunning.sh b/all/bash/lib/isRunning.sh new file mode 100644 index 0000000..7b40435 --- /dev/null +++ b/all/bash/lib/isRunning.sh @@ -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 +} \ No newline at end of file diff --git a/all/bash/nginx_start.sh b/all/bash/nginx_start.sh new file mode 100644 index 0000000..36ec0b2 --- /dev/null +++ b/all/bash/nginx_start.sh @@ -0,0 +1,9 @@ +#!/usr/bin/env bash + +source lib/execTemplate.sh + +startTemplate nginx test ${nginxPath} -t +startTemplate nginx start ${nginxPath} + + + diff --git a/all/bash/nginx_stop.sh b/all/bash/nginx_stop.sh new file mode 100644 index 0000000..293f3d5 --- /dev/null +++ b/all/bash/nginx_stop.sh @@ -0,0 +1,10 @@ +#!/usr/bin/env bash + +source lib/execTemplate.sh + +stopTemplate nginx stop ${nginxPath} "-s stop" + + + + + diff --git a/all/bash/redis_server_start.sh b/all/bash/redis_server_start.sh new file mode 100644 index 0000000..60bdb2b --- /dev/null +++ b/all/bash/redis_server_start.sh @@ -0,0 +1,4 @@ +#!/usr/bin/env bash +source lib/isOK.sh +redis-server +isOk vsftpd start $? \ No newline at end of file diff --git a/all/bash/vsftpd_start.sh b/all/bash/vsftpd_start.sh new file mode 100644 index 0000000..463cacb --- /dev/null +++ b/all/bash/vsftpd_start.sh @@ -0,0 +1,6 @@ +#!/usr/bin/env bash + +source lib/isOK.sh +systemctl start vsftpd +isOk vsftpd start $? + diff --git a/all/bash/vsftpd_stop.sh b/all/bash/vsftpd_stop.sh index f405b57..15933d7 100644 --- a/all/bash/vsftpd_stop.sh +++ b/all/bash/vsftpd_stop.sh @@ -1,5 +1,4 @@ #!/usr/bin/env bash -#!/usr/bin/env bash -echo "正在关闭vsftpd服务" +source lib/isOK.sh systemctl stop vsftpd -echo "vsftpd服务关闭成功" \ No newline at end of file +isOk vsftpd stop $? \ No newline at end of file