summaryrefslogtreecommitdiff
path: root/share
diff options
context:
space:
mode:
authorSilvio Rhatto <rhatto@riseup.net>2012-03-06 10:45:14 -0300
committerSilvio Rhatto <rhatto@riseup.net>2012-03-06 10:45:14 -0300
commit7796761af156ece9a7307c2e09894774aca25834 (patch)
treeaec4d0f0017e1120a91af0a884c0e879c86b889e /share
parentfe80d8255b6fd8901ff3d84002ab897d60c39bb4 (diff)
downloadhydra-7796761af156ece9a7307c2e09894774aca25834.tar.gz
hydra-7796761af156ece9a7307c2e09894774aca25834.tar.bz2
Check index and robots.txt on backup-site
Diffstat (limited to 'share')
-rwxr-xr-xshare/hydractl/backup-site13
1 files changed, 12 insertions, 1 deletions
diff --git a/share/hydractl/backup-site b/share/hydractl/backup-site
index f6aa230..2c448c0 100755
--- a/share/hydractl/backup-site
+++ b/share/hydractl/backup-site
@@ -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