Projet

Général

Profil

Paste
Télécharger (986 octets) Statistiques
| Branche: | Révision:

root / bin / d7-all-dump-individual.sh @ 5a4b9049

1 d52a5b2f jenselme
#!/bin/sh
2
3 15ed27d8 Julien Enselme
usage() {
4
    printf "d7-all-dump-individual.sh -m MODE\nRecognized mode are:\n\t%s\n\t%s\n" 'manunal' 'auto'
5
    printf "d7-all-dump-individual.sh -h prints this help message.\n"
6
}
7
8
mode=''
9
while getopts "hm:" opt; do
10
    case "${opt}" in
11
	h)
12
	    usage; exit 0;;
13
	m)
14 d6023b9e Julien Enselme
	    mode="${OPTARG}";;
15 15ed27d8 Julien Enselme
	:)
16
	    echo "Option -${OPTARG} requires an argument." >&2
17
	    usage >&2; exit 1;;
18
	\?)
19
	    usage >&2; exit 1;;
20
    esac
21
done
22
shift $((OPTIND-1))
23
24
25 06e9d071 Assos Assos
. /home/assos/bin/scripts-config.sh
26 d52a5b2f jenselme
. scripts-utils.sh
27
28
29 8550e097 Julien Enselme
current_date=$(date "+%Y-%m-%d-%Hh%Mm%Ss")
30 d52a5b2f jenselme
31 3e9236bd Julien Enselme
cd "${d7_dir_sites}"
32 d52a5b2f jenselme
33 8550e097 Julien Enselme
for dir in $(find . -maxdepth 1 -mindepth 1 -type d ! -name all | cut -c3-); do
34 3e9236bd Julien Enselme
    cd "${dir}"
35 d52a5b2f jenselme
    drush cc all
36 15ed27d8 Julien Enselme
    if [ "${mode}" = 'auto' ] ; then
37 b2da2166 Julien Enselme
        drush sql-dump --result-file="${d7_dir_individual_auto_backup}/${dir}/${current_date}.${dir}.sql" --gzip
38 d52a5b2f jenselme
    else
39 b2da2166 Julien Enselme
        drush sql-dump --result-file="${d7_dir_individual_manual_backup}/${dir}/${current_date}.${dir}.sql" --gzip
40 d52a5b2f jenselme
    fi
41
    cd -
42
done