Skip to content

Instantly share code, notes, and snippets.

@inerba
Last active October 12, 2020 12:35
Show Gist options
  • Save inerba/6535c5e1369a781b6cb1db8a695d9279 to your computer and use it in GitHub Desktop.
Save inerba/6535c5e1369a781b6cb1db8a695d9279 to your computer and use it in GitHub Desktop.
Scripts di utilità #sviluppo
#!/bin/sh
# Script per il backup del database
# Modificare le variabili seguenti
database=nome_del_db
username=username_db
password=password_db
# Fine modifiche
today=$(date +"%Y-%m-%d-%H-%M-%S")
filename=${database}-${today}.gz
mysqldump -u ${username} -p${password} ${database} 2>/dev/null | gzip -c > ${filename}
actualsize=$(du -h "$filename" | awk '{print $1}')
printf "%s\n Backup: " "$filename $actualsize"
#!/bin/sh
#
# This script configures WordPress file permissions based on recommendations
# from http://codex.wordpress.org/Hardening_WordPress#File_permissions
#
# Author: Wil Brown
#
# @uses /bin/sh scriptname.sh path
# @params text path to your WordPress folder from the www root e.g. / or /WordPress
#
ROOT=/home/sites/mydomainname.com/public_html #your site's root directory
if [ $# = 1 ];
then
SITE_ROOT=$ROOT$1;
#reset to safe defaults
find ${SITE_ROOT} -type d -exec chmod 755 {} \;
find ${SITE_ROOT} -type f -exec chmod 644 {} \;
# extra security configuration files
#chmod 440 ${SITE_ROOT}/config_file.php
#secure .htaccess
chmod 444 ${WP_ROOT}/.htaccess
echo "Done: Reset permissions in folder $WP_ROOT";
else
echo "You need to provide the WordPress directory relative to the root $ROOT";
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment