]> gitweb.fluxo.info Git - hydra.git/commitdiff
Check index and robots.txt on backup-site
authorSilvio Rhatto <rhatto@riseup.net>
Tue, 6 Mar 2012 13:45:14 +0000 (10:45 -0300)
committerSilvio Rhatto <rhatto@riseup.net>
Tue, 6 Mar 2012 13:45:14 +0000 (10:45 -0300)
share/hydractl/backup-site

index f6aa23027ca62d7c382266f719d912028ced7b12..2c448c0aad8a0e31e91fce4896ff81d57051c629 100755 (executable)
@@ -25,7 +25,8 @@ SITES="/var/sites"
 SITE="$1"
 PACK="$1.tar.bz2"
 DATE="`date +%Y%m%d`"
-DEST="$SITES/backups/site/$SITE/`facter hostname`/$DATE"
+DEST_BASE="$SITES/backups"
+DEST="$DEST_BASE/site/$SITE/`facter hostname`/$DATE"
 
 # Syntax check.
 if [ -z "$SITE" ]; then
@@ -54,6 +55,16 @@ else
   BACKUPS_GROUP="root"
 fi
 
+# Check destination base index
+mkdir -p $DEST_BASE
+touch $DEST_BASE/index.html
+
+# Check robots.txt
+if [ ! -e "$DEST_BASE/robots.txt" ]; then
+  echo 'User-agent: *' > $DEST_BASE/robots.txt
+  echo 'Disallow: /'  >> $DEST_BASE/robots.txt
+fi
+
 # Create folder
 mkdir -p $DEST
 cd $DEST