wordpress 自动升级Bash脚本

保持升级Wordpress是个好习惯,能及时修复暴露的漏洞,防止被恶意破坏,升级wordpress也没那么麻烦,一个脚本就可以搞定

exploit-db可查看到wordpress的各种漏洞,及时升级最新的wordpress是个好习惯

升级wordpress也没那么麻烦,一个脚本就可以搞定
bash upgradewp.sh

wget -c https://wordpress.org/latest.tar.gz
echo "解压文件"
gunzip latest.tar.gz
tar xvf latest.tar
echo "删除 latest.tar"
rm latest.tar
echo "删除 wordpress/wp-content/"
rm -rf wordpress/wp-content/

echo "删除 /app1/wp-includes/"
rm -rf /app1/wp-includes/
echo "删除 /app1/wp-admin/"
rm -rf /app1/wp-admin/

echo "删除 /app2/wp-includes/"
rm -rf /app2/wp-includes/
echo "删除 /app2/wp-admin/"
rm -rf /app2/wp-admin/

echo "cp -rf wordpress/* /app1/"
cp -rf wordpress/* /app1/
echo "cp -rf wordpress/* /app2/"
cp -rf wordpress/* /app2/

echo "删除 wordpress/"
rm -rf wordpress/

echo "访问http://app1.com/wp-admin/upgrade.php"
curl --silent http://app1.com/wp-admin/upgrade.php -o /dev/null
echo "访问http://app2.com/wp-admin/upgrade.php"
curl --silent http://app2.com/wp-admin/upgrade.php -o /dev/null

Leave a Reply

Your email address will not be published. Required fields are marked *