Linux中kettle自动化部署脚本

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

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

目前最新版本下载地址:https://sourceforge.net/projects/pentaho/files/latest/download?source=top3_dlp_t5

脚本:

 1 #!/bin/bash
 2 #Record the current directory!
 3 mulu=`pwd`
 4 #The output of JAVA_HOME number of bytes
 5 c=`echo $JAVA_HOME|wc -c`
 6 echo "Tips:Install JDK!Configuration JAVA_HOME"
 7 #Please install JDK if JAVA_HOME bytes is equal to 1
 8 
 9 if [ $c -eq 1 ];then
10 echo "Please install JDK!"
11 #If Already configured JAVA_HOME,continue!Otherwise, the exit!
12 elif [ $? != 0 ];then
13 echo "Already configured JAVA_HOME!"
14 cd ~/.kettle/
15 #If there is a file .spoonrc,continue!
16 
17 if [ -f .spoonrc ];then
18 echo "Exist .spoonrc file!"
19 aa=`cat ~/.kettle/.spoonrc |grep ShowWelcomePageOnStartup |awk -F '=' '{print $2}'`
20 #If the ShowWelcomePageOnStartup command file is empty,continue!
21 
22 if [ ! $aa ];then
23 echo "Without ShowWelcomePageOnStartup=N, appended to the file!"
24 echo "ShowWelcomePageOnStartup=N" >> ~/.kettle/.spoonrc
25 #If the file in this command ShowWelcomePageOnStartup is not equal to N,continue!
26 elif [ $aa != "N" ];then
27 echo "ShowWelcomePageOnStartup is not equal to N, to modify ShowWelcomePageOnStartup is equal to N!"
28 sed -i "s/$aa/N/g" ~/.kettle/.spoonrc
29 fi
30 
31 #If there is no file .spoonrc
32 else
33 echo "There is no file .spoonrc,Created .spoonrc file and add command!"
34 echo "ShowWelcomePageOnStartup=N" > ~/.kettle/.spoonrc
35 fi
36 #Switch to the original directory!
37 cd $mulu
38 #If there is a directory "data-integration", enter the directory, otherwise unzip the package!
39 if [ -d "data-integration" ];then
40 echo "Directory exists, into the directory!"
41 cd data-integration
42 else
43 echo "Directory does not exist, unzip the package!"
44 unzip pdi-ce-6.1.0.1-196.zip
45 cd data-integration
46 fi
47 #Install graphical interface
48 yum -y groupinstall "X Window System"
49 #Open the graphical interface!
50 echo "Open the graphical interface!"
51 sh spoon.sh
52 fi

注:脚本和pdi-ce-6.1.0.1-196.zip压缩包放到同一目录下。直接sh这个脚本。此脚本直接启动图形化界面。

posted @ 2016-08-04 18:25  派。  阅读(2055)  评论(0编辑  收藏  举报