Find the answer to your Linux question:
Results 1 to 2 of 2
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1

    Rsync utilized for backup help


    Hello, I am using rsync for incremental backups and it is working great. The issue I have is if a file is deleted on source my logs do not show it, it only shows files that have been changed or added. I would like to know if a file was accidently deleted so I may restore it from the backups.

    I would like to know if something was deleted from the source directory. Any advice how would be the best way to know when something was deleted from the source directory?


    ----------------------------

    #!/bin/bash

    # Rsync Daily Script

    #Todays date in ISO-8601 format:
    DAY0=`date -I`

    #Yesterdays date in ISO-8601 format:
    DAY1=`date -I -d "1 day ago"`

    #The source directory:
    SRC="userserver:/srv/"

    #The target directory:
    TRG="/srv/backup/$DAY0"

    #The link destination directory:
    LNK="/srv/backup/$DAY1"

    #The log file target:
    LTRG="/user/rsync_logs/dly.$DAY0"

    #The rsync options:
    ROPT="-avhi --delete --log-file=$LTRG --link-dest=$LNK -e"

    #The ssh options:
    SOPT="-p 1234 -i /user/.ssh/id_rsa_user"

    #The exclude file target:
    EXCLTRG="/user/exclude"

    #Exclude command:
    EXCL="--exclude-from $EXCLTRG"

    #Execute the backup
    rsync $ROPT "ssh $SOPT" $SRC $TRG $EXCL

  2. #2
    Linux Guru Rubberman's Avatar
    Join Date
    Apr 2009
    Location
    I can be found either 40 miles west of Chicago, in Chicago, or in a galaxy far, far away.
    Posts
    14,038
    -->
    You can run the inotify event processor to be informed when files are deleted. That can be scripted, or embedded in a C/C++ program through its API. Read the man pages for the inotify tools.
    Sometimes, real fast is almost as good as real time.
    Just remember, Semper Gumbi - always be flexible!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •