summaryrefslogtreecommitdiff
path: root/share/hydractl/backup-site
blob: 53119da864cf2165c38b8ff7823e68a218a3985e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#!/bin/bash
#
# Pack a website.
#
# TODO: put on $SITES/backups/site/$SITE, with htaccess and correct
#       ownership/permission.
#
# TODO: optionally backup database before packing
#
# TODO: add backup files in a dated folder

# Arguments
SITES="/var/sites"
SITE="$1"
PACK="$1.tar.bz2"

if [ -z "$SITE" ]; then
  hydra_action_usage
  exit 1
elif [ ! -d "$SITES/$SITE" ]; then
  echo "No such site $SITE"
  exit 1
fi

mkdir -p $SITES/backups/$SITE
cd $SITES/backups/$SITE

tar jcvf $PACK $SITES/$SITE
md5sum $PACK  > $PACK.md5
sha1sum $PACK > $PACK.sha1

echo "Saved $SITES/backups/$SITE/$PACK"