Mnemovore

Archive for April 2009

Thou hast to backup ye data!

with one comment

Bored and tired of using plain cp/rsync to backup my data so i started looking around for a backup system that would do the job right. I played a bit with rsnapshot and dar but i found out that for a simple backup task of 2-3 computer systems its an overkill. Rsnapshot by the way is really really nice and very practical, and i think i ll use it again some time. Anyway i decided to make a little snippet that will arrange my files in date folders using rsync

folder=`date +%Y_%m_%d`
mkdir -p /backup/destination/$folder
rsync -avH  /folder/to/backup /backup/destination/$folder 
#rsync -avhe ssh /folder/to/backup user@remote:dir/
tar cfj /backup/destination/$folder.tar.bz2  /backup/destination/$folder

in conjunction with a daily cron job of 22:30 every day:
crontab -e

30 22  *  *  * /bin/rsync-bak.sh

Its a good idea to bzip the product of the above operation.. saves a lot of space. I like it.. works better than a simple cp -r or rsync -ahv

Advertisements

Written by aperturefever

April 14, 2009 at 11:51 am

Posted in Linux

Tagged with , , , , ,

ad hoc-ing around

leave a comment »

The past days i got a wireless adapter and setup an ad hoc network to be able to use some wireless devices. There’s still the matter of WEP vs WAP(2) thing but nevertheless with a good password you’re good to go in both cases. Also there’s the option to increase/decrease the signal strength so security is just a matter of usage.

Anyway, i made a small console script for WEP and a bit of configuration for WAP(wpa_supplicant) and :

#!/bin/bash
#
# TODO: Option to set signal strength
#
 
echo "Create Ad-Hoc Network"
echo "_____________________"
echo

INTERFACE="wlan0"

echo -n "Type prefered ESSID (e.g. My Network, Conan's home, etc): "
read ESSID
echo -n "Insert prefered Mode (e.g. ad-hoc, master, managed etc): "
read MODE
echo -n "Channel (e.g.auto, 3, etc)  : "
read CHANNEL
echo -n "Desired pass key : "
read KEY
echo -n "IP Address : "
read IP_ADDRESS
echo -n "Netmask : "
read NETMASK
echo

ifconfig $INTERFACE up
ifconfig $INTERFACE $IP_ADDRESS netmask $NETMASK
iwconfig $INTERFACE mode $MODE
iwconfig $INTERFACE essid $ESSID
iwconfig $INTERFACE channel $CHANNEL


echo "Setting up key passphrase.."
iwconfig $INTERFACE key $KEY

echo -n "Seems that all is good.."
echo -n "Press any key to continue..."
read

Yeah i know its very simple but it works for me 😛 If one of the steps fails you ll see an indication.

As for WPA i changed a bit my wpa_supplicant.conf to look like this:

ctrl_interface=/var/run/wpa_supplicant

# By default, only root (group 0) may use wpa_cli

ctrl_interface_group=0
eapol_version=1
ap_scan=2
fast_reauth=1

# WPA protected network, supply your own ESSID and WPAPSK here:
network={
#  scan_ssid=0
  ssid="CONAN-DUDE"
  mode=1
  proto=WPA2
  key_mgmt=WPA-PSK
  pairwise=CCMP TKIP
  group=CCMP TKIP #WEP104 WEP40
  psk="*****************************"
}

# Plaintext connection (no WPA, no IEEE 802.1X),
# nice for hotel/airport types of WiFi network.
network={
  key_mgmt=NONE
  priority=0
}

and just issued the below (in a script)

killall wpa_supplicant
ifconfig wlan0 down
ifconfig wlan0 up
iwconfig wlan0 essid "CONAN-DUDE" channel auto
iwconfig wlan0 mode ad-hoc
wpa_supplicant -D wext -iwlan0 -dd -Bw -c /etc/wpa_supplicant.conf
dhclient wlan0

I have the intel 3945 wireless adapter so wext is the option for it.
For testing i run
iwlist wlan0 scan

I still have a masochistic preference for wired networks though ;p

Written by aperturefever

April 14, 2009 at 10:29 am