Full blog engine source: build_blog.py, content, deploy scripts

This commit is contained in:
2026-06-28 17:36:44 +00:00
commit 7767979538
34 changed files with 3272 additions and 0 deletions

38
revert_v2.py Normal file
View File

@ -0,0 +1,38 @@
"""REVERT v2: Remove leftover lines 13-15 from gfil Nginx config"""
import paramiko
JD_HOST = "111.228.37.165"
JD_USER = "root"
JD_PASS = "Liudecai110"
LAB_HOST = "216.144.233.14"
LAB_USER = "root"
LAB_PASS = "Kt9V72Tx2c48ChikKU"
jd = paramiko.SSHClient()
jd.set_missing_host_key_policy(paramiko.AutoAddPolicy())
jd.connect(JD_HOST, port=22, username=JD_USER, password=JD_PASS,
timeout=20, banner_timeout=60, allow_agent=False, look_for_keys=False)
# Precisely remove the 3 leftover lines
revert_cmd = r"""sshpass -p 'Kt9V72Tx2c48ChikKU' ssh -o StrictHostKeyChecking=no root@216.144.233.14 '
# Remove the 3 leftover lines from robots.txt block
sed -i "/alias \/var\/www\/gfil-lab\/robots\.txt/d" /etc/nginx/sites-enabled/gfil
sed -i "/default_type text\/plain/d" /etc/nginx/sites-enabled/gfil
# Remove the orphan closing brace on its own line after the comment line
sed -i "/^ }$/d" /etc/nginx/sites-enabled/gfil
echo "=== Final config ==="
cat -n /etc/nginx/sites-enabled/gfil
nginx -t 2>&1
if [ $? -eq 0 ]; then
systemctl reload nginx
echo "SUCCESS: Nginx reloaded, config clean"
else
echo "STILL FAILING"
fi
'"""
stdin, stdout, stderr = jd.exec_command(revert_cmd, timeout=30)
print(stdout.read().decode())
jd.close()