Pages

31 October 2010

The command line thing

I have been a regular linux user for five years now and the more I learn the more I feel that I have a whole new universe to learn ahead, which is cool and it's one of the reasons why I'm so hooked on Debian GNU/Linux. I'm going to tell you what I've learnt this week in short although I think I should write another entry so that it can be easily indexed by spiders in case anyone is googling for that specific info. But before that let me tell you that I have reached a huge conclusion:

It's that command line programs make our lives better and our tasks easier!!! Sure. I used to be a bit scared of the terminal thing but I'm more and more hooked on it. I use it so much that now I couldn't live without. The best use is to write and execute shell scripts. I'm just a beginner but with a little help of google I can say that I'm beginning to know my way into that fine art. (Simple but powerful scripts, it's all that matters).

This week I have used two CLI programs. Wodim (I had used cdrecord long ago) to write (hybrid) .iso images to cds and scrot to take screenshots. The amazing thing is that once I get used to these programs I prefer them to their GUI counterparts. For instance, now I use wget to download from the internet rather than d4x.

22 October 2010

My backup script (improved)

Some months ago I published "Backup with rsync" one of my shell scripts because I had tried several backup utilities but none suited my needs. But as so many things in life you  never finish a script. You keep on thinking about different ways to improve it. So it grows bigger and (hopefully) better. I have changed the location of the backup, instead of using a usb pendrive I bought a toshiba usb hard drive (1Tb) and added two useful features. One is the date and time in the log file and the other is that the script now sends me an e-mail with the log file.
I started working with mutt including the log file as an attachment but I think that this way it is even easier. Nevertheless I think I'll continue working with the script. I might use it to make remote backups.



Feel free to use it or adapt it to your liking and also to let me know if it useful for you. Here it is:


#! /bin/bash

#This is a very simple backup script using rsync. It copies files to a (local) usb hard drive       asuming that it is already mounted. If not, I recommend using pmount.
# The ampersand sign is used to redirect standard error to a logfile.
# I use it with anacron. (15 minutes after startup)
# I have added date and time as useful information.
# I have also added a line to send me a daily report to my e-mail address.


MAD=myemail@address.com #MAD short for Mail ADdress
rsync -rlptoDvh  --delete /home/chals/*. /media/USB-HDD/backups &> asb.log
echo $(date) >> asb.log
mail -s "Automatically Sent Backup report" $MAD < /asb.log