from small one page howto to huge articles all in one place

search text in:

What does your sytem tell when running "ulimit -u"?

poll results

Last additions:
using iotop to find disk usage hogs

using iotop to find disk usage hogs






average rating: 1.7 (85 votes) (1=very good 6=terrible)

May 25th. 2007:




why adblockers are bad

Workaround and fixes for the current Core Dump Handling vulnerability affected kernels

Workaround and fixes for the current Core Dump Handling vulnerability affected kernels






average rating: 1.3 (28 votes) (1=very good 6=terrible)

April, 26th. 2006:

Druckversion . pdf icon
You are here: System->Tips and Tricks

Using 'make' for backups

Thanks to Lars Weiler for providing this tip.

Usualy make from sys-devel/make is known as a tool for compiling applications. But it could also be used to provide often used commands so that they can be accessed easily.

Quite everybody wants to do backups. This could be done by packing them with tar. For instance, we want to pack the ~/Mail folder and name the file with a date:
Code Listing 1: tar ~/Mail with date included

$ tar cvjf ~/Backups/Mail-`date +%F`.tar.bz2 ~/Mail

After that we copy that file (and possibly more) to another computer by using rsync and delete all the files in ~/Backups afterwards:
Code Listing 2: Copy backup-file to another computer with rsync

$ rsync -avute ssh ~/Backups/ user@othermachine:~/Backups/
% rm ~/Backups/*

And now comes the clue with make. After a week you already forgot the commands. Why not store them in a Makefile located in the home-directory, so that you only have to call make backup?

Inside the Makefile (beware of the uppercased 'M') we provide two targets for the commands, so that we can call them separately, e.g. if you only want to copy the files. The first target backup will only call the other targets in the given order:

Code Listing 3: Sample Makefile for backups

backup: compress copy


        tar cvjf ~/Backups/Mail-`date +%F`.tar.bz2 ~/Mail
        rsync -avute ssh ~/Backups/ user@othermachine:~/Backups/
        rm ~/Backups/*

Now we can call make backup in the home directory and the ~/Mail-folder will be compressed and copied to the other computer. The restore-command-set will be your homework ;-)

Of course, there is a wide use for batched processes with Makefiles. Think about all the things you ever wanted to have scripted with easy usability. You can find more instructions in the info make pages.

rate this article:
current rating: average rating: 1.0 (33 votes) (1=very good 6=terrible)
Your rating:
Very good (1) Good (2) ok (3) average (4) bad (5) terrible (6)

Support this site

Please read "Why adblockers are bad".

Other free services
Shorten long
URLs to short
links like
Reverse DNS lookup
Find out which hostname(s)
resolve to a
given IP or other hostnames for the server
rdf newsfeed | rss newsfeed | Atom newsfeed
- Powered by LeopardCMS - Running on Gentoo -
Copyright 2004-2017 Sascha Nitsch Unternehmensberatung UG(haftungsbeschränkt)
Valid XHTML1.1 : Valid CSS : buttonmaker
- Level Triple-A Conformance to Web Content Accessibility Guidelines 1.0 -
- Copyright and legal notices -
Time to create this page: 4.6 ms