标签:
自己写的一个自动化在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,虽然脚本中有提示。此脚本直接启动图形化界面。
标签:
原文地址:http://www.cnblogs.com/womars/p/5737327.html