[mythtv-users] Want to automatically backup my music directory

Steven Adeff adeffs.mythtv at gmail.com
Tue Dec 28 20:57:36 UTC 2010


On Tue, Dec 28, 2010 at 1:24 PM, Gabe Rubin <gaberubin at gmail.com> wrote:
> Hi list,
>
> I have all of my music on my windows box which I mount on my mythbox
> using samba.  I have decided that I want to shut down the windows box
> when it is not in use.  I have plenty of space on my mythbox, so I
> figure I can just backup all my music to the mythbox in its own
> directory so that myth can play the music when the windows box is not
> on (also allowing me to have a backup in case anything goes wrong).
>
> I am guessing I want use rsync, but I am not too familiar with how to
> do it.  Can anyone give me guidance on how to write a script that I
> can call from a cron job that will first check to see if the windows
> share is actually accessible (i am thinking the script would do an ls
> of the mounted directory and return a false if the directory is empty
> and a true if the directory contains files) and if the script returns
> a true, then use rsync or some other tool to backup the mounted
> directory (/win/music) to a specified directory (/music)?
>
> Appreciate any help I can get.

I use rdiff for this purpose. I have a script that runs as a cron job hourly,

#!/bin/bash
echo "My Music Backup" >> /var/log/rdiff-music.log
rdiff-backup --no-carbonfile --exclude-globbing-filelist \
        /etc/cron.hourly/rdiff-music.exclude \
        -v 9 /media/storage/4/Music/Music/ /media/storage/3/Music \
        >> /var/log/rdiff-music.log
rdiff-backup --no-carbonfile -v 9 \
        --include-globbing-filelist /etc/cron.hourly/rdiff-music.include \
        --exclude /media/storage/4/Music/Music \
        /media/storage/4/Music/Music/ /media/storage/1/Music/ \
        >> /var/log/rdiff-music.log
rdiff-backup -v 8 --remove-older-than 14D --force /media/storage/1/Music \
        >> /var/log/rdiff-music.log
rdiff-backup -v 8 --remove-older-than 14D --force /media/storage/3/Music \
        >> /var/log/rdiff-music.log
chown -R adeffs:adeffs /media/storage/1/Music
chown -R adeffs:adeffs /media/storage/3/Music

rdiff-music.include and rdiff-music.exclude contain what I do want to
backup and what I don't. I have the music for all my housemates on the
server and I don't need to back those up, just my personal music
purchases.

-- 
Steve
http://www.mythtv.org/wiki/User:Steveadeff
Before you ask, read the FAQ!
http://www.mythtv.org/wiki/index.php/Frequently_Asked_Questions
then search the Wiki, and this list,
http://www.gossamer-threads.com/lists/mythtv/
Mailinglist etiquette -
http://www.mythtv.org/wiki/index.php/Mailing_List_etiquette


More information about the mythtv-users mailing list