码迷,mamicode.com
首页 > 系统相关 > 详细

Linux中kettle自动化部署脚本

时间:2016-08-04 19:16:26      阅读:444      评论:0      收藏:0      [点我收藏+]

标签:

自己写的一个自动化在Linux中部署kettle的脚本,包括一些遇到的问题在脚本中都有涉及。

kettle是官网版本pdi-ce-6.1.0.1-196.zip

脚本:

#!/bin/bash
#Record the current directory!
mulu=`pwd`
#The output of JAVA_HOME number of bytes
c=`echo $JAVA_HOME|wc -c`
echo "Tips:Install JDK rather than JRE!Configuration JAVA_HOME"
#Please install JDK if JAVA_HOME bytes is equal to 1

if [ $c -eq 1 ];then
echo "Please install JDK!"
#If Already configured JAVA_HOME,continue!Otherwise, the exit!
elif [ $? != 0 ];then
echo "Already configured JAVA_HOME!"
cd ~/.kettle/
#If there is a file .spoonrc,continue!

if [ -f .spoonrc ];then
echo "Exist .spoonrc file!"
aa=`cat ~/.kettle/.spoonrc |grep ShowWelcomePageOnStartup |awk -F = {print $2}`
#If the ShowWelcomePageOnStartup command file is empty,continue!

if [ ! $aa ];then
echo "Without ShowWelcomePageOnStartup=N, appended to the file!"
echo "ShowWelcomePageOnStartup=N" >> ~/.kettle/.spoonrc
#If the file in this command ShowWelcomePageOnStartup is not equal to N,continue!
elif [ $aa != "N" ];then
echo "ShowWelcomePageOnStartup is not equal to N, to modify ShowWelcomePageOnStartup is equal to N!"
sed -i "s/$aa/N/g" ~/.kettle/.spoonrc
fi

#If there is no file .spoonrc
else
echo "There is no file .spoonrc,Created .spoonrc file and add command!"
echo "ShowWelcomePageOnStartup=N" > ~/.kettle/.spoonrc
fi
#Switch to the original directory!
cd $mulu
#If there is a directory "data-integration", enter the directory, otherwise unzip the package!
if [ -d "data-integration" ];then
echo "Directory exists, into the directory!"
cd data-integration
else
echo "Directory does not exist, unzip the package!"
unzip pdi-ce-6.1.0.1-196.zip
cd data-integration
fi
#Open the graphical interface!
echo "Open the graphical interface!"
echo "If it does not have a graphical interface, please install,Use this command yum groupinstall \"X Window System\"!"
sh spoon.sh
fi

 注:脚本和pdi-ce-6.1.0.1-196.zip压缩包放到同一目录下。最好先装好X Window System,虽然脚本中有提示。此脚本直接启动图形化界面。

Linux中kettle自动化部署脚本

标签:

原文地址:http://www.cnblogs.com/womars/p/5737327.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!