Monthly Archives: May 2014

Automated WordPress Backup on Uberspace

This is how I backup this site, hosted on Uberspace.

Note: All scripts should be made executable: chmod +x script

I created the following file ~/bin/backup_wordpress.sh:

#!/bin/bash
NOW=$(date +"%Y-%m-%d-%H%M")
FILE="blog.dirkz.com.$NOW.tar"
BACKUP_DIR="/home/uberspace_/backups"
WWW_DIR="/var/www/virtual/uberspace_/blog.dirkz.com/"

DB_USER="user"
DB_PASS="pass"
DB_NAME="db_name"
DB_FILE="blog_dirkz_com.$NOW.sql"

WWW_TRANSFORM='s,^var/www/virtual/user/blog.dirkz.com,www,'
DB_TRANSFORM='s,^home/user/backups,database,'

tar -cvf $BACKUP_DIR/$FILE --transform $WWW_TRANSFORM $WWW_DIR
mysqldump -u$DB_USER -p$DB_PASS $DB_NAME > $BACKUP_DIR/$DB_FILE

tar --append --file=$BACKUP_DIR/$FILE --transform $DB_TRANSFORM $BACKUP_DIR/$DB_FILE
rm $BACKUP_DIR/$DB_FILE gzip -9 $BACKUP_DIR/$FILE

Created a cronjob (`crontab -e’) with the following content (daily is sufficient for me):

@daily /home/uberspace_user/bin/backup_wordpress.sh

To fetch those backups I created a tiny local script (~/bin/fetch_uberspace_backups.sh):

#!/bin/bash
rsync ip@ip.menkar.uberspace.de:backups/* /home/local_user/backup/uberspace_ip
ssh ip@ip.menkar.uberspace.de 'rm backups/*'

Then setup anacron on a local machine (vi /etc/anacrontab as root):

@daily  10      fetch.uberspace.backups nice run-parts /home/local_user/bin/fetch_uberspace_backups.sh

My local backup folder should now be filling with backups. I also set MAILTO to my email address, so I get noticed a couple of days (as a reminder to verify everything’s ok). After that I will remove it.

Install VLC via rpmfusion on Fedora 20

These are my notes for installing VLC on Fedora 20, using only rpmfusion free:

gpg --keyserver pgp.mit.edu --recv-keys AE688223 B5F29883
yum localinstall http://download1.rpmfusion.org/free/fedora/rpmfusion-free-release-$(rpm -E %fedora).noarch.rpm
gpg --fingerprint AE688223 B5F29883
yum install -y vlc mozilla-vlc

The RPM Fusion Keys were as follows during my installation:

pub   4096R/AE688223 2013-01-01
  Key fingerprint = 0017 DDFE FD13 2929 9D55  B1D3 963A 8848 AE68 8223
uid                  RPM Fusion free repository for Fedora (20) <rpmfusion-buildsys@lists.rpmfusion.org>

pub   4096R/B5F29883 2013-01-01
  Key fingerprint = A84D CF58 46CB 10B6 5C47  6C35 63C0 DE8C B5F2 9883
uid                  RPM Fusion nonfree repository for Fedora (20) <rpmfusion-buildsys@lists.rpmfusion.org>

If you want to install libdvdcss, you need to add another repo and then install it:

yum localinstall http://dl.atrpms.net/f20-x86_64/atrpms/stable/atrpms-repo-20-7.fc20.x86_64.rpm
yum install libdvdcss

This is the fingerprint I observed:

Importing GPG key 0x66534C2B:
 Userid : "ATrpms.net (rpm signing key) <Axel.Thimm@ATrpms.net>"
 Fingerprint: 7d6a 4524 1d82 5ec2 fde5 9651 508c e5e6 6653 4c2b  
 Package : atrpms-repo-20-7.fc20.x86_64 (@/atrpms-repo-20-7.fc20.x86_64)
 From : /etc/pki/rpm-gpg/RPM-GPG-KEY-atrpms

Switch ALT with CMD on Apple keyboards on Linux with Kernel 3.13

A feature introduced in kernel 3.13 enables you to easily switch alt and cmd keys on apple keyboards. The following is for Fedora 20:

Switch alt and cmd temporarily (as root). Note that GNOME 3 didn’t seem to realize that during my limited testing, whereas Mate picked it up on the fly:

echo "1" > /sys/module/hid_apple/parameters/swap_opt_cmd

Edit/create /etc/rc.d/rc.local with the following contents to make this permanent:

#!/bin/sh
echo "1" > /sys/module/hid_apple/parameters/swap_opt_cmd

Make it executable:

chmod 700 /etc/rc.d/rc.local