You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.
#! /bin/sh
### BEGIN INIT INFO
# Description: 前端重启部署脚本
#执行教程:
### END INIT INFO
# 主目录
ocr_web_prefix = /server/ocr/web
function getTime( ) {
current = ` date "+%Y%m%d%H%M%S" `
#timeStamp=`date -d "$current" +%s`
#将current转换为时间戳, 精确到毫秒
#currentTimeStamp=$((timeStamp*1000+`date "+%N"`/1000000))
currentTimeStamp = $current
return $currentTimeStamp
}
currentTimeStamp = ''
case " $1 " in
*)
getTime
#进入项目目录
cd $ocr_web_prefix /source
echo "拉取最新代码"
#拉取代码
git pull
#将打包的代码复制到nginx目录
if [ -f " $ocr_web_prefix /source/dist/index.html " ] ; then
echo "备份上次的部署文件=====>>"
mv $ocr_web_prefix /dist $ocr_web_prefix /dist-$currentTimeStamp
echo "将打包的代码复制到nginx目录======>>"
#存在,做备份
cp -r $ocr_web_prefix /source/dist $ocr_web_prefix /
fi
echo "操作成功"
; ;
esac