Monthly Archives: May 2013

How to make daily backups with rsync and cronjobs

It’s always a good idea to make backups of important data (documents, images, music, etc.), e.g. the worst case for students is to lose data of written reports or theses.
I wanted to make backups of my documents and source codes every day. The backup should be stored on a usb flash drive. But I also wanted to keep deleted files for a couple of days, in case of accidentally deleted files. There are many ways to complete this task, but I decided to use rsync and cronjobs for this purpose. Both tools make the backup process very flexible. It’s very easy to manage the time of the backup process with cronjobs and rsync makes it easy to change the destination (e.g. another folder, device or remote host).
My idea was to add a cronjob to start a bash script which uses rsync to copy the directories and files to the flash drive. But the device names of flash drives changes, if you plug them in a different order. To avoid this problem, I added a udev rule to create a symbolic link every time the flash drive is plugged.
Read the rest of this entry

How to trim strings with bash

If you want to trim a string from or to a certain pattern, you don’t have to invoke cut, sed or awk. You can use the % operator to trim a string from the first or last occurrence of a pattern to the end or the # operator to trim from the beginning to the first or last occurrence of it.
Read the rest of this entry

How to install Slackware ARM on a Raspberry Pi

A few days ago I got my Raspberry Pi and I had to decide which OS I install. I like Slackware and decided to give Slackware ARM (formerly ArmedSlack) a try. It was surprisingly easy to install it.
The first step was to download the Slackware ARM installer and copy it to the SD card.
Download installer:

$ wget

Write the installer to SD card:

$ xz -dc raspi-slack-installer_01Aug12.img.xz | dd of=[device] bs=65536
Read the rest of this entry