52 13 * * 7 root mount /dev/sda3 /media/da2dc69c-92cc-4249-b2c3-9b00847e7106
.
53 13 * * 7 knoppix5 df -h >~/df.txt
.
54 13 * * 7 knoppix5 env DISPLAY=:0 /usr/bin/gedit ~/df.txt && wmctl -a gedit
.
55 13 * * 7 root /home/knoppix5/rdiff-backup.sh
.
line one: as root mount media for backup on Sunday 13:52
line two: as user knoppix5 write out to text file in home directory the free space of all mounted disks on Sunday 13:53
line three: in front of you open and display a very simple text editor (I prefer gedit) with content of previously reported disk usage at Sunday 13:54
wmctl -a gedit means (from the manual):
-a Switch to the desktop containing the window , raise the window, and give it focus.
line four: as root run incremental backup script rdiff-backup.sh as root on Sunday 13:54
.
my rdiff-backup.sh, with root permissions backups in short time (writes only changes from the last backup) the etire linux system (except excluded - i.e. you don't want backup recursively your backup disk), looks like this (Show sample output):
rwxr-xr-x 1 root root 561 Tra 10 20:59 /home/knoppix5/rdiff-backup.sh . $ cat /home/knoppix5/rdiff-backup.sh #!/bin/bash #uncomment next two lines if you run script manually (not from cron) #mount /dev/sda3 /media/da2dc69c-92cc-4249-b2c3-9b00847e7106 #sleep 3 rdiff-backup --exclude=/run --exclude=/dev --exclude=/tmp --exclude=/media --exclude=/mnt --exclude=/proc --exclude=/sys / /media/da2dc69c-92cc-4249-b2c3-9b00847e7106/rdiff-backup && sleep 3 umount /media/da2dc69c-92cc-4249-b2c3-9b00847e7106 # Important: never ever lose your thunderbird mail again - run backup script (e)very soon!
Any thoughts on this command? Does it work on your machine? Can you do the same thing with only 14 characters?
You must be signed in to comment.
commandlinefu.com is the place to record those command-line gems that you return to again and again. That way others can gain from your CLI wisdom and you from theirs too. All commands can be commented on, discussed and voted up or down.
Every new command is wrapped in a tweet and posted to Twitter. Following the stream is a great way of staying abreast of the latest commands. For the more discerning, there are Twitter accounts for commands that get a minimum of 3 and 10 votes - that way only the great commands get tweeted.
» http://twitter.com/commandlinefu
» http://twitter.com/commandlinefu3
» http://twitter.com/commandlinefu10
Use your favourite RSS aggregator to stay in touch with the latest commands. There are feeds mirroring the 3 Twitter streams as well as for virtually every other subset (users, tags, functions,…):
Subscribe to the feed for:
df -h | gedit - &
gedit --version
gedit - Version 3.14.3gedit -V
gedit - Version 2.30.4 . "This is a new feature in Gedit. It was introduced in the version that came with Gnome 3.0." ( http://stackoverflow.com/questions/3864814/how-to-pipe-program-output-in-an-editor )