The following is an example of how we keep track of changes to a /cfmc directory on the server. This runs hourly and is our primary backup against data loss on this server. Because FSVS and SVN only send the differences across the wire, it's a very efficient method. And since this is protecting client data, we're going to version control it and keep it for years.
The magic trick is the FCOUNT= line which runs FSVS and looks to see whether there were any changes to files in the monitored directory tree. If it found changes, then we go ahead and do an automated commit.
#!/bin/sh # Only executes FSVS if FSVS reports outstanding changes FSVS_CONF=~/.fsvs-conf FSVS_WAA=~/.fsvs-waa export FSVS_CONF FSVS_WAA cd /cfmc FCOUNT=`/usr/local/bin/fsvs | grep -v 'dir.*\.$' | wc -l` if [ $FCOUNT -gt 0 ] ; then /usr/local/bin/fsvs ci -m "Automatic FSVS snapshot" else echo "Nothing changed" fi
No comments:
Post a Comment