1. Please take a little time for this simple survey! Thank you for participating!
    Dismiss Notice
  2. Dear Pleskians, please read this carefully! New attachments and other rules Thank you!
    Dismiss Notice
  3. Dear Pleskians, I really hope that you will share your opinion in this Special topic for chatter about Plesk in the Clouds. Thank you!
    Dismiss Notice


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

  1. DoobyWho

    DoobyWho Guest

    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.

  2. jamesyeeoc

    jamesyeeoc Guest

    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

    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:

    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

    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

    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

    Ok found:

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


    Thanx James!
  7. Mr.Yes

    Mr.Yes Guest

    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:


    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

    any suggest?