【发布时间】:2015-11-21 10:15:49
【问题描述】:
我为 Dev、Cert、PPE、PROD 部署创建了自动化部署脚本。开发脚本工作正常。但是我无法运行证书。任何人都可以请帮忙。这个 shell 脚本将处理以下任务: 1.从提取的“书”网络应用程序中删除现有的2个文件。 2. 复制新的 2 个文件 - 在从桥位置提取的“书”网络应用程序中。
但我在参加 CERT 时遇到了问题。
#start for each host
for i in "${servers_array[@]}"
do
ssh_to_remote_host="ssh -l bookweb -i /export/home/apps/bookplus/.ssh/id_dsa ";
#find the hostname and it's application path
case $i in
#CERT3 Viewer Book Server
b3pclcertview01)
app_path=$view_3_app_path;
book_config=$view_3_config_path;
;;
#CERT2 Viewer Book Server
b3bookvm14)
app_path=$view_2_app_path;
book_config=$view_2_config_path;
;;
#CERT1 Viewer Book Server
b3bookvm02)
app_path=$view_1_app_path;
book_config=$view_1_config_path;
;;
#CERT SMS Viewer Book Server
b3bookvm03)
app_path=$sms_1_app_path;
book_config=$sms_1_config_path;
;;
#CERT RUMBA Viewer Book Server
b3bookvm09)
app_path=$rumba_1_app_path;
book_config=$rumba_1_config_path;
;;
*) echo "`date "+%Y-%m-%d %H:%M:%S"` $i is not a valid option exiting"
exit 0;;
esac #end case
if [ "$i" = $deploymentserver ]
then
ssh_to_remote_host=""; #This is the host from deployment will be done. Therefore it is required to set off ssh command and use normal "cp" command
i="";
fi
echo "`date "+%Y-%m-%d %H:%M:%S"` Start deployment at hostname $i ......................";
#deleting files - ViewerMain_r49.swf & launchBookViewer.jsp from extracted “book” webapps
rm -rf $app_path/apache-tomcat-6.0.35/webapps/book/jsp/viewer/launchBookViewer.jsp;
rm -rf $app_path/apache-tomcat-6.0.35/webapps/book/flex/ViewerMain_r49.swf;
#verify file is deleted
if [ ! -f "$app_path/apache-tomcat-6.0.35/webapps/book/jsp/viewer/launchBookViewer.jsp" ];
then echo "File 'launchBookViewer.jsp' is deleted";
fi
if [ ! -f "$app_path/apache-tomcat-6.0.35/webapps/book/flex/ViewerMain_r49.swf" ];
then echo "File 'ViewerMain_r49.swf' is deleted";
fi
#start deployment of file
$ssh_to_remote_host $i cp -rp $etext_build_location/launchBookViewer.jsp $app_path/apache-tomcat-6.0.35/webapps/book/jsp/viewer/;
$ssh_to_remote_host $i cp -rp $etext_build_location/ViewerMain_r4121.swf $app_path/apache-tomcat-6.0.35/webapps/book/flex/;
if [ "$?" -ne 0 ]
then
echo "`date "+%Y-%m-%d %H:%M:%S"` node ${i} : files could not be deployed";
exit 0;
else
echo "`date "+%Y-%m-%d %H:%M:%S"` files deployed at hostname: $i ......................";
fi
done #end deployment
【问题讨论】:
-
你遇到了什么问题?
-
请提供SSCCE
标签: bash unix deployment ssh putty