sixtydoses. where od is harmless.

November 17, 2008

Back them up.

Filed under: Tech — Tags: , , , — od @ 9:07 pm

I learned my lesson the hard way. Last 2 years I bought a 120gb WD hard drive and used it for about 6 months before it suddenly died on me. 6 months, it was still covered by the warranty, but I chose not to return it for an exchange of a new one. I have tons of data inside but out of all data, I just need prolly around 30% of it. The rest, I can say goodbye with tears in my eyes. I still have the hard disk, kept nicely inside my wardrobe. When I have the chance, I’ll bring it back to live!

I love Maxtor hard drive. I still have one old Maxtor hdd that I’ve been using for almost 8 years running. In fact I used to have 2 of them. One has failed, but it is completely acceptable since it has served me for over 6 years.

Currently at work am preparing backup scripts for some servers. I find that backing up the entire directory of windows virtual machine is kinda annoying. Am thinking of what would be the best way to shutdown windows without using the force flag? Urgh. I wish I can just init 0.

At home I use a simple script that I wrote to backup directories. Basically what it does is it checks the content of both source and target directories, and any files/directories that are not available at the target location will be copied, creating a duplicate copy of the original directory. It’ll also generate a log (diff.log) to record what files that have been copied over. I use it to backup log files, nothing in giga size.


sSOURCE=`echo $SOURCE | awk -F/ ‘{print $NF}’`
sDEST=`echo $DEST | awk -F/ ‘{print $NF}’`
DATE=`date +”%v”`

echo “Directories comparison on $DATE” >> diff.log

diff -rq $SOURCE $DEST >> diff.log

s1=”Directories comparison on $DATE”
s2=`sed ‘$!d’ diff.log`

if [ “$s1” != “$s2” ]; then
sed -n ‘/'”$date”‘/,$p’ diff.log > copy.out

echo “Directory(s)/file(s) copied from $sSOURCE to $sDEST:” >> diff.log
f1=`sed -n ‘/^[Only in ]* /s///;s/:.///p’ copy.out`
f2=`sed -n ‘/Files/s/^.*Files.(.*) and.*$/1/p’ copy.out`


cp -vR $f1 $f2 $DEST >> diff.log

echo “Directory $sSOURCE is unchanged since yesterday.” >> diff.log

echo >> diff.log
echo “—————————————————————” >> diff.log
echo >> diff.log


The output of diff.log will be something like this:

Directories comparison on 15-Nov-2008
Only in /home/od/personal/script/cmp2dirs/diffmv/cmp2: white space 2
Directory(s)/file(s) copied from cmp2 to temp:
/home/od/personal/script/cmp2dirs/diffmv/cmp2/white space 2 -> ./temp/white space 2
/home/od/personal/script/cmp2dirs/diffmv/cmp2/white space 2/wsp -> ./temp/white space 2/wsp


Directories comparison on 16-Nov-2008
Directory cmp2 is unchanged since yesterday.


Directories comparison on 17-Nov-2008
Only in /home/od/personal/script/cmp2dirs/diffmv/cmp2: ghi
Directory(s)/file(s) copied from cmp2 to temp:
/home/od/personal/script/cmp2dirs/diffmv/cmp2/ghi -> ./temp/ghi


November 16, 2008

Braces yourself for the braces!!!

Filed under: Life — Tags: , , — od @ 1:52 pm

It is too special that am writing about it on a separate page!

November 14, 2008

:) :D :(

Filed under: Life — Tags: — od @ 7:08 am


Am gonna miss the old look of myself šŸ˜¦

But anyways, am excited šŸ™‚ !!!