1. Please take a little time for this simple survey! Thank you for participating!
    Dismiss Notice

TotalBackup

Discussion in 'Plesk for Linux - 8.x and Older' started by DoobyWho, Oct 13, 2005.

  1. DoobyWho

    DoobyWho Guest

    0
     
    I've got TotalBackup configured on my server for backups, how would I make it so that it would mount my 2nd hard drive before TotalBackup starts and dismount it after?

    Also - what user does TotalBackup run as? I'd like to restrict the backup directory so that no one but myself and TotalBackup can access it.

    Thanks!
     
  2. jamesyeeoc

    jamesyeeoc Guest

    0
     
    You would write a script to do the mount, then call the /usr/local/tbackup/do_backup script, then unmount the drive. You would then place your script in the root crontab in place of the job which is normally put there by 4PSA. Since it is in 'root' crontab, the software runs as the root user.

    Actually I would name the script as do_backup and rename their original as do_backup_orig, then call the do_backup_orig from the new script, that way the cronjob won't have to change at all. I believe they run another script to check and re-insert things like that. In any case, that would be less messy overall.

    Hope this helps.
     
  3. Mr.Yes

    Mr.Yes Guest

    0
     
    Hi james,

    maybe you can help me on this problem;

    assuming i have a directory /home/backup/psadump where i keep last 7 days backupfiles, well i use the following script to copy this directory every night out of the box in my NAS storage:

    #!/bin/sh
    smbmount //smbackup.dll.server.com/cc001/mnt/nas -o username=cc001,password=mypass
    cd /mnt/nas
    rm -rf backup
    mkdir backup
    cp -r /home/backup/psadump/* backup/
    cd /

    rm -f /root/nas_backup_notify.txt
    ls -lR /mnt/nas/backup/ > /root/nas_backup_notify.txt
    cat /root/nas_backup_notify.txt | mail -s "Server - Nas Backup Log `date +%F`" myname@email.com

    smbumount /mnt/nas

    # Done

    I'm not so good as coder but i would like to be able to copy every night on my nas the last backup file only and not the entire directory with all the files inside. At the moment,as you can see, the copy process is not very smart, deleting every night the directory on the nas and then copying again the full local directory containing the same files already there .. except the last new one.

    I don't know if i explained clearly my question .. :)

    Can you help me with this?

    Thanx in advance
     
  4. jamesyeeoc

    jamesyeeoc Guest

    0
     
    You could try adding the -u option to the copy command:

    From "man cp" -
    -u, --update
    copy only when the SOURCE file is newer than the destination
    file or when the destination file is missing

    and of course remove the "rm -rf" and "mkdir" commands from your script.
     
  5. Mr.Yes

    Mr.Yes Guest

    0
     
    Thank you James, it works perfectly, i only have a last question:
    how can i keep on the nas the same number of backup files i have in the source directory (last 3 days)?

    Otherwise i will need hundred of terabytes on the nas :)

    Thank you for you support
     
  6. Mr.Yes

    Mr.Yes Guest

    0
     
    Ok found:

    find /mnt/nas/backup -name "psabackup*.tar" -mtime +2 -exec rm "{}" ";"

    ;)

    Thanx James!
     
  7. Mr.Yes

    Mr.Yes Guest

    0
     
    Hi James,

    i noticed that the -u option it works only with files with today date. Let me explain better.

    in the source directory i have 3 backup files, every night my backup script generates a new file and the oldest file will be deleted, so i will have always 3 files. Ok now i have a nas service where i want to copy the 3 backup files for the reasons you know.

    In the source directory i have for example:

    backup-02-21-2006-psadump.tar
    backup-02-22-2006-psadump.tar
    backup-02-23-2006-psadump.tar

    when i performed the script for the first time naturally it correctly copy all 3 files, preserving modification date too with -p option. Perfect you say? No ... i don't know why but next time i perform the copy script it wants to overwrite
    backup-02-21-2006-psadump.tar
    backup-02-22-2006-psadump.tar

    any suggest?
     
Loading...