A friend of mine made this script to backup files from all my ubuntu boxes using lftp to an ftp server i setup on my local windows 7 machine using apache and abilityftp server. However it is only backing up some config files(see attached screen), none of the actual directories are being backed up. I can't figure out if the problem lies in the script or what?
for i in `ls /home/`
echo "mirror -rR /home/$i $i" | lftp -u $FTPUSER,$FTPPASS $SERVERIP
echo "User $i Backed Up"
I see a couple of potential issues here. I think the real answer lies in your "mirror" command. I'm not familiar with a 'mirror' command, so is it safe to assume that's a script? Could you paste that script here as well?
If the problem is that it's not copying the sub-directories, then it sounds like there's maybe a recursive flag missing somewhere.
Hmm, yeah ive been researching that recrusive flag. The mirror command is an lftp command, just type "man lftp" in terminal and scroll down. I'm pretty sure that recursive flag is there hence the -rR??
Wow, that works perfect now, seems my buddy thought he knew a little more than he did. I think what he was trying to do was use the rsync flag -r(recursive- recurse into directories) and -R(realtive -use relative names). It seems that this script copies all users home directories, do you know how i could make it relative to the account launching the script, so that it would only copy that users home? Thanks Gromit, you rock!
If you just want it to back up the home directory of the user launching the script, all you reall have to do is declare the directory you want to back up and take out the 'for' loop. I'd probably do something like this:
Hey Gromit, I tried that script and it sill copies over all user files over, not just the one launching it. It created a folder called home and stored my two users home directories there. You have been very helpful so far, and I'm trying to figure this out on my own, but am struggling. Would replacing $whoami with $user be the proper step?