posts tagged as rsync

scripting rsync

Tuesday, 9 February 2010 6:45 am by noel
posted in tech | tags: , ,

here’s the script i use on secure backup runs using rsync—with a little modification to the names and ip addresses for security reasons—but everything else is essentially the same. i have to run this through cron because the server is headless—no monitor. i just access it via the ssh console or browser from another computer.

#!/bin/sh

DATETMP=`date +%Y.%m.%d`
RSYNC=/usr/bin/rsync
SSH=/usr/bin/ssh
# the private ssh key of the local computer
KEY=/rsyncuser/.ssh/id_local
RHOST=remote.ip.addr.ess
RPATH=/remotedata/
LPATH=/localdata/
LOGFILE=/rsyncuser/rlog.$DATETMP.log
# contains the file extensions of files to be excluded from the backup
EXCLUDES=/rsyncuser/localexcludes
OPTS="--exclude-from=$EXCLUDES"

# check if rsync is already running
RUN=`ps x | grep rsync | grep -v grep | wc -l`
if [ "$RUN" -gt 0 ]; then
echo rsync already running
exit 1
fi

$RSYNC -avz -e "$SSH -i $KEY" $OPTS $RHOST:$RPATH $LPATH >> $LOGFILE

i leave an entry in crontab to run the script once each day. sometimes a backup run goes longer than 24 hours so i needed to check if rsync is already running in the server. if the script doesn’t check, it will run another instance of the script and would slow down the server or, worse, brings it down completely.

i have to encrypt all data that gets transferred between the two computers via ssh just in case a naughty third party is “listening in”. i use 2048-bit encryption. processing the data—encrypt at remote; decrypt at local—is a little slower but i am more confident that the data will be safe from eavesdroppers.

i use the exclude-from option to exclude files that shouldn’t be backed up—music and movies—or else the backup will take too long especially on just a dsl line.

if you notice anything wrong with the script, please leave a comment.

note: this is repost from my old blog.

tiny changes in jaunty

Monday, 27 April 2009 5:14 pm by noel
posted in tech | tags: , , , , , , ,

i noticed a couple of things that changed when i ugraded to ubuntu 9.04

  • the menu entry of grsync was moved from applications – internet to applications – system tools
  • opera disappeared. i don’t exactly know how but the .opera subdiretory with my previous settings was still there. i just had to download the latest .deb package directly from the opera website. it wasn’t in the add/remove applications program and there’s one dubious looking entry in synaptic so i decided to do a direct download.
  • skype disappeared too (there’s a pattern here). so i had to download the .deb package directly from skype. because of the relative newness of ubuntu 9.04, the available versions are for ubuntu 8.10 but these should work as before.
  • after ugrading to firefox 3.0.9 flash videos became choppy. i remember uninstalling the flash plugins–all of them–via synaptic. then downloading and installing the latest .deb from the adobe website. i also noticed that firefox’s memory footprint became quite a bit larger–a little over 500 megabytes in my case–especially after spending a good amount of time in javscript and ajax-heavy sites i.e. facebook.
  • the booting, shutdown and login screens are new.
  • when shutting down the computer there’s a new confirmation dialog box with a 60-second countdown timer confirming if you really want to shutdown or not. this also applies when you want to restart the computer.
  • booting seems faster–around 20 seconds on one workstation.
  • there’s a new theme called new wave which i switched to.

i’m just wondering how it performs with older computers (pentium 4, 256 meg ram). if you know, please leave a note.