June 2010 Archives

Wed Jun 9 16:23:49 EDT 2010

Shell script to backup NanoBlogger to a remote server

This is a simple script that creates full backups of our NanoBlogger blog by compressing our DocumentRoot directory and upload it to a remote server via SCP.

Lets take a look at it:

#!/bin/bash
BLOG_PATH="/path/to/the/directory/that/contains/your/blog.conf/"
BLOG_NAME="orvtech.com"
DATE=`date +%d%b%Y-h%Hm%M`
NO_BAKUP="cache/*"
SCP_SERVER=""
SCP_USER=""
SCP_PORT="22"

cd $BLOG_PATH
tar -czpsf ~/$BLOG_NAME-nanoblogger.$DATE.tar.gz --exclude "$NO_BAKUP" *
ls -lah  ~/$BLOG_NAME-nanoblogger.$DATE.tar.gz
scp -P$SCP_PORT ~/$BLOG_NAME-nanoblogger.$DATE.tar.gz $SCP_USER@$SCP_SERVER:~/


Spanish version: Respaldar NanoBlogger.


Posted by orvtech | Permanent link | File under: Scripts, Linux, nanoblogger