dbUpGrade update

This commit is contained in:
zhangkun9038@dingtalk.com 2024-04-20 12:11:03 +08:00
parent c6e87a35c8
commit 82c526da30
3 changed files with 76 additions and 0 deletions

View File

@ -13,6 +13,9 @@ ossPath=$7
projectName="sql" projectName="sql"
projectPath=${tempPath}/${projectName} projectPath=${tempPath}/${projectName}
filename_no_extension="${sqlfile%.sql}"
dbName="${filename_no_extension:0:3}"
protal=oss protal=oss
function init(){ function init(){
@ -51,6 +54,12 @@ function replaceAndExec(){
rm $sqlFile rm $sqlFile
rm sqlOut.log rm sqlOut.log
cp $tempPath/$sqlFile . cp $tempPath/$sqlFile .
# 获取当前日期并格式化为YYYY-MM-DD的形式
current_date=$(date +'%Y-%m-%d')
# 获取当前时间并格式化为HH:MM:SS的形式
current_time=$(date +'%H:%M:%S')
fileName="abc_${current_date}-${current_time}.sql"
/usr/bin/mysqldump -u${dbUser} -p${dbPassword} -P${dbPort} $dbname > $fileName
/usr/bin/mysql -u${dbUser} -p${dbPassword} -P${dbPort} -e "$(cat ${sqlFile})" | tee sqlOut.log /usr/bin/mysql -u${dbUser} -p${dbPassword} -P${dbPort} -e "$(cat ${sqlFile})" | tee sqlOut.log
ossutil cp -f sqlOut.log ${protol}://${ossPath}/${dbHost}/sqlOut.log ossutil cp -f sqlOut.log ${protol}://${ossPath}/${dbHost}/sqlOut.log
} }

35
replacessh.sh Normal file
View File

@ -0,0 +1,35 @@
#!/bin/bash
yum install -y openssl-devel zlib-devel
wget https://www.openssl.org/source/openssl-1.1.1l.tar.gz
tar -xzvf openssl-1.1.1l.tar.gz
cd openssl-1.1.1l
./config --prefix=/usr/local/openssl --openssldir=/usr/local/openssl shared zlib
make
make install
cp -f /root/openssl-1.1.1l/libssl.so.1.1 /usr/lib64/ || true
cp -f /root/openssl-1.1.1l/libcrypto.so.1.1 /usr/lib64/ || true
export PATH=/usr/local/openssl/bin:$PATH
ldconfig
openssl version
mv /usr/bin/openssl /usr/bin/openssl_old
mv -f /usr/local/openssl/bin/openssl /usr/bin/openssl
cd ~
wget https://cdn.openbsd.org/pub/OpenBSD/OpenSSH/portable/openssh-9.7p1.tar.gz
tar -zxvf openssh-9.7p1.tar.gz
cd openssh-9.7p1/
./configure --prefix=/usr/local/openssh --with-ssl-dir=/usr/local/openssl --without-openssl-header-check
make
make install
cp -r /etc/ssh /etc/ssh_backup
systemctl stop sshd
sleep 2
cp -f /usr/local/openssh/sbin/sshd /usr/sbin/sshd
cp -f /usr/local/openssh/bin/ssh /usr/bin/ssh
sleep 2
systemctl start sshd

32
replacessh2.sh Normal file
View File

@ -0,0 +1,32 @@
#!/bin/bash
tar -xzvf openssl-1.1.1l.tar.gz
cd openssl-1.1.1l
./config --prefix=/usr/local/openssl --openssldir=/usr/local/openssl shared zlib
make
make install
cp -f /root/openssl-1.1.1l/libssl.so.1.1 /usr/lib64/ || true
cp -f /root/openssl-1.1.1l/libcrypto.so.1.1 /usr/lib64/ || true
export PATH=/usr/local/openssl/bin:$PATH
ldconfig
openssl version
mv /usr/bin/openssl /usr/bin/openssl_old
mv -f /usr/local/openssl/bin/openssl /usr/bin/openssl
cd ~
tar -zxvf openssh-9.7p1.tar.gz
cd openssh-9.7p1/
./configure --prefix=/usr/local/openssh --with-ssl-dir=/usr/local/openssl --without-openssl-header-check
make
make install
cp -r /etc/ssh /etc/ssh_backup
systemctl stop sshd
sleep 2
\cp -f /usr/local/openssh/sbin/sshd /usr/sbin/sshd
\cp -f /usr/local/openssh/bin/ssh /usr/bin/ssh
sleep 2
systemctl start sshd