Posted September 12, 201113 yr Got an portable external hd which im going to format with FAT32 What i am looking for is basically a user script that i can simply click from ummenu/user scripts I want it to backup /unraid/home /unraid/pictures /unraid/flash to the external hd in dated backup folders (see example below) backup[date] (and within in this folder are subfolders) home pictures flash
September 12, 201113 yr Author this is just a rough script i put together just now... could someone bit more linux minded have a quick look mkdir /mnt/exthd mount /dev/sde /mnt/exthd mkdir /exthd/`backup '+%m%d%y'` cp -r /unraid/home/* /exthd/`backup '+%m%d%y'`/home cp -r /unraid/pictures/* /exthd/`backup '+%m%d%y'`/pictures cp -r /unraid/flash/* /exthd/`backup '+%m%d%y'`/flash umount /dev/sde
September 12, 201113 yr this is just a rough script i put together just now... could someone bit more linux minded have a quick look mkdir /mnt/exthd mount /dev/sde /mnt/exthd mkdir /exthd/`backup '+%m%d%y'` cp -r /unraid/home/* /exthd/`backup '+%m%d%y'`/home cp -r /unraid/pictures/* /exthd/`backup '+%m%d%y'`/pictures cp -r /unraid/flash/* /exthd/`backup '+%m%d%y'`/flash umount /dev/sde When mounting the external drive you'll need to give the file system type in the mount command. You'll also need to use the correct partition name, not the device name. So... if the disk is /dev/sde, the partition name (of its first partition) will probably be /dev/sde1 and the mount command mount -t vfat /dev/sde1 /mnt/exthd the umount command would then be umount /dev/sde1 the "cp" commands are wrong too There is no /unraid directory. Instead they should be referencing /mnt/user cp -r /mnt/user/home/* /exthd/`backup '+%m%d%y'`/home cp -r /mnt/user/pictures/* /exthd/`backup '+%m%d%y'`/pictures cp -r /mnt/user/flash/* /exthd/`backup '+%m%d%y'`/flash
September 24, 201113 yr Author ok, still having problems... #!/bin/bash mkdir -p /mnt/exthd/`date '+%d%m%y'`/{home,pictures,music,flash} mount -t vfat /dev/sdg1 /mnt/exthd cp -r /mnt/user/home/* /mnt/exthd/`date '+%d%m%y'`/home cp -r /mnt/user/pictures/* /mnt/exthd/`date '+%d%m%y'`/pictures cp -r /mnt/user/music/* /mnt/exthd/`date '+%d%m%y'`/music cp -r /boot/* /mnt/exthd/`date '+%d%m%y'`/flash umount /dev/sdg1 rm -rf /mnt/exthd when i invididually put in these commands through terminal one by one it works but then i run as a script it creates folders with a \r e.g. /mnt/exthd/250911/pictures\r /mnt/exthd/250911/home\r /mnt/exthd/250911/music\r /mnt/exthd/250911/flash\r the culprit is this command mkdir -p /mnt/exthd/`date '+%d%m%y'`/{home,pictures,music,flash} it just does not work in a script but works fine but inputting it into terminal... weird
Archived
This topic is now archived and is closed to further replies.