| Server IP : 92.204.28.36 / Your IP : 216.73.217.69 Web Server : Apache System : Linux sxb1plmcpnl510317.prod.sxb1.secureserver.net 4.18.0-553.141.2.lve.el8.x86_64 #1 SMP Wed Jul 8 16:10:02 UTC 2026 x86_64 User : f981716tud7w ( 9071646) PHP Version : 8.4.23 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /home/f981716tud7w/public_html/useful/dlt/ |
Upload File : |
#!/bin/bash
# bash upd-wordpress.sh - run like this
# Directories
LIVE_DIR="/home/f981716tud7w/www/dragonloretours.com/www"
UPDATE_SRC="/home/f981716tud7w/www/useful/wordpress"
BACKUP_DIR="/home/f981716tud7w/www/useful/dlt/live-backups"
TIMESTAMP=$(date +%Y%m%d%H%M%S)
# DB Credentials (from wp-config.php)
DB_NAME="dlt_db"
DB_USER="dlt_dbu"
DB_PASS="8mkQ&!g7?yPR"
echo "=== Updating WordPress Core ==="
echo "Step 1: Backing up live files and database..."
# Create backup directories if they don't exist
mkdir -p "$BACKUP_DIR"
# Backup live site files (excluding /wp-content, wp-config.php, .htaccess for simplicity)
tar --exclude="wp-content" --exclude="wp-config.php" --exclude=".htaccess" -czf "$BACKUP_DIR/www-core-backup-$TIMESTAMP.tar.gz" -C "$LIVE_DIR" .
# Backup database
mysqldump -u"$DB_USER" -p"$DB_PASS" "$DB_NAME" > "$BACKUP_DIR/db-backup-$TIMESTAMP.sql"
echo "Step 2: Updating WordPress core files..."
# rsync with exclusions to preserve custom files and plugins
rsync -a --exclude="wp-content" --exclude="wp-config.php" --exclude=".htaccess" "$UPDATE_SRC/" "$LIVE_DIR/"
echo "Step 3: Setting permissions..."
find "$LIVE_DIR" -type d -exec chmod 755 {} \;
find "$LIVE_DIR" -type f -exec chmod 664 {} \;
chmod 444 "$LIVE_DIR/wp-config.php"
chmod 444 "$LIVE_DIR/.htaccess"
echo "Step 4: Purging opcode and server cache (optional)..."
# Uncomment if using opcache
# php -r 'opcache_reset();'
echo "Step 5: Update complete. Please check site frontend and backend for any issues."
# Cleanup old backups (older than 30 days, adjust as needed)
find "$BACKUP_DIR" -type f -mtime +30 -name "*.tar.gz" -exec rm {} \;
find "$BACKUP_DIR" -type f -mtime +30 -name "*.sql" -exec rm {} \;
echo "Backup, update, and cleanup complete!"