自己写过的一些shell脚本

#!/bin/sh
#!/usr/tcl/bin/expect -f

export thisDir=$(cd $(dirname $BASH_SOURCE) && pwd)
echo $thisDir
pwd
cd $thisDir
echo "*"
echo "*"
echo "*"
echo "*"
echo "ɾ³ý¾ÉµÄ°æ±¾Îļþ"
echo "*"
echo "*"
echo "*"
echo "*"
sh $thisDir/updateInit.sh
echo "*"
echo "*"
echo "*"
echo "*"
echo "¿½±´×îа汾Îļþ"
echo "*"
echo "*"
echo "*"
echo "*"

nocheck="\"StrictHostKeyChecking=no\""
systemVersion=""
systempwd=""
M9000versionpath=""
M9000pwd=""
M900versionpath=""
M900pwd=""
MS90versionpath=""
MS90pwd=""
localpath=""
if [ ! -e tem.ini ]
then
     cat /dev/null > $thisDir/tem.ini
fi
sed '/^#/d' $thisDir/autoTest.ini |sed '/^$/d' > $thisDir/tem.ini
sleep 2
eval `cat $thisDir/tem.ini`

if [ "$systemVersion" != "" -a "$systempwd" != "" ]; then
        expect -c "
        spawn scp -o "$nocheck" $systemVersion $localpath
        set timeout 85
        expect \"*Password: \"
        send \"$systempwd\r\"
        set timeout 600
        expect eof
        "
else
###############¿½±´M9000°æ±¾#################

        if [ "$M9000versionpath" != "" -a "$M9000pwd" != "" ]; then
        expect -c "  
        spawn scp -o "$nocheck" $M9000versionpath $localpath                 
        expect \"*Password: \"
        send \"$M9000pwd\r\"
        set timeout 600
        expect eof
        "
        fi

###############¿½±´M900°æ±¾##################

        if [ "$M900versionpath" != "" -a "$M900pwd" != "" ]; then
        expect -c "  
        spawn scp -o "$nocheck" $M900versionpath $localpath                         
                expect \"*Password: \"
        send \"$M900pwd\r\"
                set timeout 600
        expect eof
        "
        fi

##################¿½±´MS90##################

        if [ "$MS90versionpath" != "" -a "$MS90pwd" != "" ] 
        then
        expect -c " 
        spawn scp -o "$nocheck" $MS90versionpath $localpath 
        #expect \"connecting (yes/no)?\"
        #send \"yes\r\"
        #sleep 80
        set timeout 81
        expect \"*assword: \"  
        #set timeout 80
        send \"$MS90pwd\r\"
        set timeout 90 
        expect eof 
        "
        fi
fi
rm -rf $thisDir/tem.ini

if [ ! -e /home/mcu_version/MS90InServerAndM9000_*.tar.gz ]
then
        echo "            >>ÈýºÏÒ»°æ±¾ÓÐÒì³£<<   "
        export AllFlag=0
fi
if [ ! -e /home/mcu_version/M9000_M9000C_Version*.gz ]
then
        echo "            >>M9000°æ±¾ÓÐÒì³£<<   "
        export M9000Flag=0
fi
if [ ! -e /home/mcu_version/MS90InM900_V1.*.zip ]
then
        echo "            >>M900°æ±¾ÓÐÒì³£<<   "
        export M900Flag=0
fi
if [ ! -e /home/mcu_version/M9000_M9000C_Version*.gz ]
then
        echo "            >>MS90°æ±¾ÓÐÒì³£<<   "
        export MS90Flag=0
fi
echo "*"
echo "*"
echo "*"
echo "*"
echo "½âѹËùÓа汾Îļþ"
echo "*"
echo "*"
echo "*"
echo "*"
sleep 5
sh $thisDir/upload90later.sh
exit

 远程拷版本,记录目录,ini,等等

猜你喜欢

转载自syyzxq.iteye.com/blog/2207443