On Fri 21 January 2011 11:44:24 Freddie Cash wrote:
> #!/bin/sh
> 
> ssh someu...@mythtv.pc "/path/to/some/script stop"
> 
> /path/to/your/rsync/script
> 
> ssh someu...@mythtv.pc "/path/to/some/script start"

Ho-lee crap, this is fantastic.  Everything seems to work.  I find though that 
if I stop myth -and- mysql, I cannot export the database, so I only stop Myth.  
It's the only thing using the database anyway, in my case.

Well it's been 12 hours and I'm still doing my first HTPC data transfer, so not 
all commands are tested (untested==#), but I am confident they will work.  I'm 
donating my (weekly) cron script here in case it helps someone. (below)

I have four systems:
hex - work laptop
droog - HTPC with a 4TB btrfs raid0 array on /home and 500GB raptor on /
slepnir - backup server in a cube case out in the garage (in case of theft or 
fire) with a SuperMicro 5 disk hot-swap cage, 6TB so far. (WD Green 2TB now $80 
with rebate!)
phone - Android Nexus One with 16GB SD

The backup server has SSH credentials on the other systems, but only the work 
laptop can ssh to it (limited by Shorewall).  The backup server will also 
handle security cameras and will presumably dnat a port to the HTPC, which will 
serve it to the WAN on SSH (reverse tunnel) so I can get motion notifications 
and video on my phone. (ZoneMinder)  The HTPC is the only system allowed to 
present anything to the WAN as it has nothing sensitive, and -that- will be on 
a subnet.  Maybe I can limit it to my phone's IP.

I do have a (disused) WindowsXP partition, but unsure how to back that up.  
Maybe ssh with a dd command.

Thanks for the help all.

backups
---------------------------------------------------------------------------------------------------------------------------------
#!/bin/sh
#
# cron.weekly/backups -- schedules periodic backups of darkmatter systems
#
# Copyleft © Carl Cook
#
#--archive is  equivalent  to  'recursive links perms times group owner 
DevicesSpecials'

/bin/mount /media/backups

#------------------------------------------------------
# Hex

#/sbin/btrfs subvolume snapshot /media/backups/hex-home/ 
/media/backups/hex-home-snap-$(date +"%Y-%m-%d")
/usr/bin/rsync --archive --checksum --compress --hard-links --delete-during 
--delete-excluded --inplace --numeric-ids 
--log-file=/media/backups/hex-home-$(date +"%Y-%m-%d").log -e ssh 
root@hex:///home/ /media/backups/hex-home/

#/sbin/btrfs subvolume snapshot /media/backups/hex-root/ 
/media/backups/hex-root-snap-$(date +"%Y-%m-%d")
#/usr/bin/rsync --archive --checksum --compress --hard-links --delete-during 
--delete-excluded --inplace --numeric-ids 
--exclude-from=/media/backups/exclude-root 
--log-file=/media/backups/hex-root-$(date +"%Y-%m-%d").log -e ssh root@hex:/// 
/media/backups/hex-root/

#------------------------------------------------------
# Droog

#/sbin/btrfs subvolume snapshot /media/backups/droog-home/ 
/media/backups/droog-home-snap-$(date +"%Y-%m-%d")
/usr/bin/rsync --archive --checksum --compress --hard-links --delete-during 
--delete-excluded --inplace --numeric-ids 
--log-file=/media/backups/droog-home-$(date +"%Y-%m-%d").log -e ssh 
root@droog:///home/ /media/backups/droog-home/

/usr/bin/ssh root@droog "/etc/init.d/mythtv-backend stop"
/usr/bin/ssh root@droog "/usr/bin/mysqldump -u mythtv -pmythtv mythconverg -c > 
/home/bill/.mythtv/mysql_backup-$(date +"%Y-%m-%d").sql"
/usr/bin/ssh root@droog "/etc/init.d/mythtv-backend start"
/sbin/btrfs subvolume snapshot /media/backups/droog-root/ 
/media/backups/droog-root-snap-$(date +"%Y-%m-%d")
/usr/bin/rsync --archive --checksum --compress --hard-links --delete-during 
--delete-excluded --inplace --numeric-ids 
--exclude-from=/media/backups/exclude-root 
--log-file=/media/backups/droog-root-$(date +"%Y-%m-%d").log -e ssh 
root@droog:/// /media/backups/droog-root/

#------------------------------------------------------
# Phone

#/sbin/btrfs subvolume snapshot /media/backups/phone-sd/ 
/media/backups/phone-sd-snap-$(date +"%Y-%m-%d")
#/usr/bin/rsync --archive --checksum --compress --hard-links --delete-during 
--delete-excluded --inplace --numeric-ids 
--log-file=/media/backups/phone-sd-$(date +"%Y-%m-%d").log -e ssh 
root@hex:///media/disk-1/ /media/backups/phone-sd/

#------------------------------------------------------

/bin/umount /media/backups

---------------------------------------------------------------------------------------------------------------------------------
--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to