• ALGEMENE VOORWAARDEN
  • GENERAL TERMS & CONDITIONS

KUDOS - IT consultant and FOSS supporter

  • home
  • contact
  • services
  • baanboard
  • for sale
  • msx
Home

Amarok backup script

patvdv's picture

patvdv — Fri, 05/06/2009 - 15:54

I am a big fan of the superb music player and organizer AmaroK, one of KDE's flagship programs. AmaroK supports multiple database backends for storing information about the music collection (e.g. mp3 files) and until recently I was using the default SQLite backend. The amarok SQLite database is located in the user's home directory and as such it is pretty important to have a decent backup of the AmaroK database in case a calamity occurs. What follows is the listing for a very simple AmaroK backup script that uses the SQLite backend.

Note: you should adjust the variables DUMP_DIR, DUMP_FILE and LOG_FILE variables at the beginning of the script.

#!/bin/bash
#
# This script make as copy of the amaroK SQLite DB
#
DUMP_DIR="/home/patrick/shares/backup/amarok"
DUMP_FILE="$DUMP_DIR/backup_amarokdb_$(date '+%H%M-%d%m%Y').tar"
LOG_FILE="$HOME/logs/backup_amarok_sqlitedb.log"

if [[ ! -d $DUMP_DIR ]]
then
    mkdir -p $DUMP_DIR
fi

mkdir $DUMP_DIR >/dev/null 2>&1
START_TIME=$(date '+%s')

echo "INFO: starting backup of amaroK SQLite DB at $(date '+%X')" | tee -a $LOG_FILE
cd $HOME
tar cvf $DUMP_FILE .kde/share/apps/amarok/*
tar rvf $DUMP_FILE .kde/share/config/amarok*
gzip $DUMP_FILE
echo "INFO: finished backup of amaroK SQLite DB at $(date '+%X')" | tee -a $LOG_FILE

FINISH_TIME=$(date '+%s')
DURATION=$(($FINISH_TIME - $START_TIME))
SIZE=$(ls -s ${DUMP_FILE}.gz | cut -f1 -d" ")
echo "INFO: backup complete (duration: $DURATION seconds / size: $SIZE KB)" | tee -a $LOG_FILE

exit 0
Bookmark/Search this post with
  • del.icio.us del.icio.us
  • Digg Digg
  • Facebook Facebook
  • Google Google
  • identi.ca identi.ca
  • LinkedIn LinkedIn
  • Ping This! Ping This!
  • Reddit Reddit
  • StumbleUpon StumbleUpon
  • Technorati Technorati
  • Twitter Twitter
  • Yahoo Yahoo
  • Add new comment

Navigation

  • Glossary
  • Recent posts

Search

User login

  • Request new password

Recent comments

  • Great Command
    4 weeks 1 day ago
  • "Match" sshd_config keyword, an alternative?
    22 weeks 2 days ago
  • startup
    1 year 16 weeks ago
  • sweet
    1 year 16 weeks ago
  • On the same port
    1 year 35 weeks ago
  • All, with 2 daemons running
    1 year 39 weeks ago
  • /etc/init.d/sshd
    1 year 43 weeks ago
  • No easy way to do this
    1 year 43 weeks ago
  • external iface is dhcpd addressed
    1 year 43 weeks ago
  • Great
    1 year 45 weeks ago

Use Free Software!

Visit the Free Software Directory

Baanboard.com

  • Validating a field value with no Standard Script
  • How I can Access ERP LN 6.1 through .NET
  • Calling Standard ERP Maintain Session in read only mode
  • Infor Report Studio (Birt) with Oracle DB
  • SLM Time Out
more

  • home
  • contact
  • services
  • baanboard
  • for sale
  • msx