Skip to content

Instantly share code, notes, and snippets.

View Arvoreen's full-sized avatar

Eduard Martinescu Arvoreen

View GitHub Profile
@Arvoreen
Arvoreen / azurenight-backup
Created March 28, 2019 02:34
Site specific clean up script. Assumes alias already configured in wp-cli
#!/bin/bash
wp @azurenight search-replace 'https://www.azurenight.com' 'https://backup.azurenight.com'
sed -i 's/\/var\/www\/html/\/var\/www\/localhost\/htdocs/' /var/www/localhost/htdocs/azurenight/.htaccess
perl -p -i -e 'print "define('"'"'JETPACK_STAGING_MODE'"'"',true);\n" if /^.*Happy blogging.*$/' /var/www/localhost/htdocs/azurenight/wp-config.php
@Arvoreen
Arvoreen / backup-remote
Created March 28, 2019 02:32
Backup script that runs on remote site. Assumes already configured aliases for wp-cli
#!/bin/bash
# Current backup variables
DAY=`date +%d`
MONTH=`date +%m`
YEAR=`date +%Y`
# old backup vairables
OLDDAY=`date -d"400 days ago" +%d`
OLDMONTH=`date -d"400 days ago" +%m`
OLDYEAR=`date -d"400 days ago" +%Y`
PATH=$PATH:/usr/local/bin
@Arvoreen
Arvoreen / backup
Last active March 28, 2019 02:32
Backup script -- runs on hosting site, assumes already setup aliases for wp-cli
#!/bin/bash
PATH=$PATH:/usr/local/bin
# Loop through all sites,
echo "Starting backups @$(date)"
for site in $(cat $HOME/etc/sites); do
cd $HOME/backups
BKDIR="$HOME/backups/$site/"
if [ ! -d "$BKDIR" ]; then