Author Archives: loopion - Page 3

Nightly backup your WordPress database and files

After rading Using a Cron job to keep things safe I didn’t found this really a complete procedure as it only backup the database… I think it’s better to backup everything at once and we usually have some associated files like for example themes, images uploaded, etc… remaining that we don’t won’t to lost. So here is a solution to keep a copy of everything no matter what happen and unobstructive while visitors are visiting.

UPDATE 03/02/2011 -1.1:

  • Added a functionality to remove all file into the backup folder older than the specified number of days. Just set days_delete and it will delete all files older than days_delete days.
  • Added security to stop script if an error goes wrong

Just set up a cronjob and you’re good to go.

#!/bin/sh
#
# Written by Emmanuel Pays 
#
# Description : Use this script to backup a WordPress blog
#
# wordpress_backup.sh ver. 1.1
#
# Latest version can be found at http://blog.loopion.com/

# Global config
set -e
www_path="/var/www/vhosts/"
backup_path_db="${www_path}backup_db/"
backup_path_files="${www_path}backup_files/"
domain="yourdomain.tld"
days_delete=5

#Production info
prod_uri="www.${domain}"
root_prod_path="${www_path}httpdocs/"
prod_db_name="name"
prod_db_username="username"
prod_db_pass="password"
#Create backup
backup_db_filename="database_$(date +%F_%Hh%M).bak.sql.bz2"
backup_file_filename="files_$(date +%F_%Hh%M).tar.bz2"

#Create files backups
tar -cjPf ${backup_path_files}prod_${backup_file_filename} ${root_prod_path}
chown ftproot:psaserv ${backup_path_files}prod_${backup_file_filename}
echo "Backup prod files done..."

mysqldump --add-drop-table -h localhost -u ${prod_db_username} -p${prod_db_pass} ${prod_db_name} | bzip2 -c > ${backup_path_db}${backup_db_filename}
chown ftproot:psaserv ${backup_path_db}${backup_db_filename}
echo "All backups done..."

#Delete older backups
find ${backup_path_db}* -mtime +${days_delete} -exec rm {} \;
echo "Deleted last ${days_delete} database backup"
find ${backup_path_files}* -mtime +${days_delete} -exec rm {} \;
echo "Deleted last ${days_delete} files backup"

Coming soon a deployment script…

Delete all .SVN folders and files from a directory

Nice DOS command script to remove all .svn files and folders. Some guy’s don’t know already the export function of SVN…

for /f "tokens=* delims=" %%i in ('dir /s /b /a:d *svn') do (
rd /s /q "%%i"
)

Am I a curator?

Link: Am I a curator?

En lisant cet article je me suis énormément reconnu. Pouvez vous me le confirmer ?

Il faut toujours avoir des projections pessimiste mais avoir une motivation et un morale optimiste. Non ?

Mulve.com – Mp3 Music Search and Music Downloads

Link: Mulve.com – Mp3 Music Search and Music Downloads

Ok, now we are talking! Piracy will continue and drain a lot of new users everyday. How do you want to stop that?

Mulve sounds to get 90’s and early 00’s back on the stage with Napster like software, where are we going?

Answer: in a KISS direction. Keep It Stupid Simple!

[Flash 10 is required to watch video.]

Salsa afterwork at meatpacking.

Beach… Headset… Rest… Peaceful…

Dedicated to someone that will recognize his self

via media.smashingmagazine.com

via Nathan Hurst’s Blog