shell__ Romote copy sybase - wxl1989beyond/wxl GitHub Wiki

  1. copy sybase directroy
  2. ./installsybase.sh 127.0.0.1 1

#!/bin/bash

isSybaseExist()

{
if [ -d “/opt/sybase” ]; then
echo -e `date`“: sybase has exisit, exit install. \\n” >> $logfile 2>&1
exit
fi

echo -e `date`“: sybase not exisit \\n” >> $logfile 2>&1

}

copySybase()
{
type=$1
userpass=“Test1234{}”

echo -e `date` “: start copy \\n” >> $logfile 2>&1 if [ “$type”x = "1"x ]; then echo -e “go …….\\n”

expect -c "
exp_internal 1
spawn scp -rp 10.145.98.201:/opt/sybase/ /opt/
sleep 1
expect {
\“yes/no\” {send \“yes\r\”;exp_continue}
}
set timeout 7200
expect word:
send $userpass\r
expect eof" >> $logfile 2>&1

echo -e `date` “: finish copy \\n” >> $logfile 2>&1
echo "finish "
return 1
fi

if [ “$type”x = "2"x ]; then echo “anthor type” fi

}

modifyInterfaceFile()
{
sed -i “s/10.145.98.201/”$1"/g" /opt/sybase/interfaces
echo -e `date` “: modify interfaces finish \\n” >> $logfile 2>&1
}

logfile=$(pwd)/installSybase.log

isSybaseExist

copySybase $2

modifyInterfaceFile $1

⚠️ **GitHub.com Fallback** ⚠️