公司的产品应用服务部署Shell脚本编写
背景:公司开发的新应用,需要编写脚本,执行应用的自动化部署。
根据应用产品要求,编写步骤如下:
1.定义目录和日志文件
2.创建目录并更改权限
3.上传应用配置
4.上传应用
5.应用启动
1. Shell应用部署脚本
#!/bin/bash
#auth:CHL
#func:APP安装
#清屏
clear
cat << EOF
==============Thank Use APP Automaic Deploy Script==================================
=========================================================================================
EOF
sleep 3
#定义安装目录、及日志信息
. /etc/init.d/functions
[ $(id -u) != "0" ] && echo "Error: You must be root to run this script" && exit 1
#smartops根目录
smartops_dir=/opt/APP
#smartops 配置文件目录
smartops_conf=/etc/APP
#smartops 日志目录
smartops_log=/var/log/APP
#smartops pid目录
smartops_pid=/var/run/APP
#安装日志目录
log_dir=APP.log
#传入内容,格式化内容输出。
output_msg() {
for msg in $*;do
action $msg /bin/true
done
}
#服务部署目录创建
create_dir() {
output_msg "服务目录创建"
for dirname in $*;do
mkdir -p $dirname >/dev/null 2>&1
cho

本文介绍了如何使用Shell脚本来实现公司新应用的自动化部署,包括定义目录、设置权限、上传配置和应用、以及启动应用等关键步骤,旨在实现高效且可靠的部署流程。作者首次尝试编写脚本,期待读者提供改进建议。
最低0.47元/天 解锁文章
1722

被折叠的 条评论
为什么被折叠?



