Tiny Core Linux
Tiny Core Extensions => TCE Q&A Forum => Topic started by: remus on February 18, 2013, 07:39:31 PM
-
Hi all,
Are there any extensions in microcore 3.8.4 that allow me to setup a backup ?
- Backup will be to 1TB ext usb hard drive.
- Would be handy if I could just plug the drive in, and have the backup take place without any other input (The staff who does the offsite backup is not linux literate).
- Would be great if the backup software sent a email on backup fail/sucess.
Opinions and comments welcome.
-
There are lots of packages that can be used to do backups:
rsync, tar, cpio, dd etc.
Since Core is meant to be a tool kit, you can use any of the above.
Personally, I like rsync for that kind of backup.
-
Thanks gerald_clark,
I have found examples of using rsync and scripts to do a backup and email a log file as an attachment, will look into that. Can mc send mail via smtp with attachments, or will I have to use mutt or something else.
Found this
http://yarbu.sourceforge.net/
It looks like a handy program, and has email notification as well.
I'll see if I can get it to compile on mc and if its good, will submit it as an extension.
-
Hi remus
This may be of some use as a basic template for detecting, mounting, and unmounting the drive:
#!/bin/sh
DRIVE=""
while [ -z "$DRIVE" ] # Wait for device to be plugged in
do
DRIVE=`blkid -U 6b92c5e1-f49e-480e-87a0-8c1391a873c6 | cut -c6-9`
sleep 2
done
DEST=/mnt/$DRIVE
while [ ! -e "$DEST" ] do; sleep 2; done # Wait for mount point to be created
ERROR=`mount $DEST`
if [ -n "$ERROR" ]
then
echo "Mount command failed and returned the following error:"
echo $ERROR
echo "Backup was not performed"
exit
fi
echo "Starting backup now. Do not unplug the drive"
#-------------Insert backup commands here ----------------------
#---------------------------------------------------------------
umount $DEST
echo "Backup complete. It is now safe to unplug the drive"
-
For emailing the status/log there's always mailx.tcz.
-
Thanks for the tip about mailx.tcz Lee
Thanks for the script template Rich :)
-
Hi remus
You are welcome. If you decide to make use of the script, replace 6b92c5e1-f49e-480e-87a0-8c1391a873c6 with
the UUID of your backup drive. The variable $DEST will point to the root of your backup drive, ie. /mnt/sda3