• ALGEMENE VOORWAARDEN
  • GENERAL TERMS & CONDITIONS

KUDOS - IT consultant and FOSS supporter

  • home
  • contact
  • services
  • baanboard
  • 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:
  • Delicious Delicious
  • Digg Digg
  • StumbleUpon StumbleUpon
  • Propeller Propeller
  • Reddit Reddit
  • Magnoliacom Magnoliacom
  • Google Google
  • Yahoo Yahoo
  • Technorati Technorati
  • Add new comment

Navigation

  • Glossary
  • Recent posts

Search

User login

  • Request new password

Recent comments

  • Great!
    1 week 16 hours ago
  • Thanks!
    2 weeks 6 days ago
  • keyboard-interactive?
    2 weeks 6 days ago
  • no authentication method
    2 weeks 6 days ago
  • nicely written
    2 weeks 6 days ago
  • Awesome! Thank you!
    9 weeks 5 days ago
  • Excellent script
    9 weeks 5 days ago
  • Not corrupt but wrong file extension
    41 weeks 5 hours ago
  • Download Corrupt
    41 weeks 9 hours ago
  • Possibly not desireable
    41 weeks 4 days ago

Use Free Software!

Visit the Free Software Directory

Baanboard.com

  • Report based on parent BP
  • Display Session
  • External EDI
  • Bod
  • SAP v. Waste Management: A $500M ERP implementation fiasco
more

UNIX.com

  • How to spilt huge string in AIX ?
  • Concatenate Loop Results
  • Windows to Unix Admin
  • Put output into an array
  • Using SED command in a shell script: Unterminated address regex
more

  • home
  • contact
  • services
  • baanboard
  • msx