This script uses Fuse/SSHFS to mount a remote machine via SSH as a local drive. Once mounted, any file(s) can be copied just like a local drive.
Use it, change it, distribute it. Please consider linking back to the source when you do if possible.Code:#!/bin/sh ## # Description: SSH/Fuse mount, backup and umount script. # Execute via cron for schedule backups over # secure shell. # # Author: Jordan DeLozier # Date: 1-19-2009 # Usage: ./BackupScript.sh # # Must run as root # Must use SSH Key Authentication for automatic updates ## # For some reason the kernel module doesn't always # load on boot. Load it now /sbin/modprobe fuse # Mount the remote SSH machine, if there # is an error exit. This prevents the files from # being copied to the local machine and using # local hard disk space # # Replace <username>,<server>,/path/to/files/ and /mnt/<dir> with # proper values. ## if (!(/usr/local/bin/sshfs <username>@<server>:/path/to/files/ /mnt/<dir>)); then echo "Mount Failed" exit 1 fi # Copy the Files # Using -Ru recursively copies and only copies # files that are different from the target. # # Replace /source/files and /mnt/<dir of mount> ## cp -Ru /source/files/ /mnt/<dir of mount> # Unmount # # Replace /mnt/<dir of mount> ## umount /mnt/<dir of mount>
Last edited by Jordan; 06-17-2009 at 01:04 PM.
its work properly.....hey can u give me an algorithma
Huh? Algorithm for what?
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks