Projet

Général

Profil

Paste
Télécharger (1,02 ko) Statistiques
| Branche: | Révision:

root / bin / d7-all-dump-individual.sh @ 1aa883a3

1 d52a5b2f jenselme
#!/bin/sh
2
3 15ed27d8 Julien Enselme
usage() {
4 346e604b Florent Torregrosa
    printf "d7-all-dump-individual.sh -m MODE\nRecognized mode are:\n\t%s\n\t%s\n" 'manual' 'auto'
5 15ed27d8 Julien Enselme
    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 653aeb8e Julien Enselme
. /home/assos/bin/scripts-utils.sh
27 d52a5b2f jenselme
28
29 8550e097 Julien Enselme
current_date=$(date "+%Y-%m-%d-%Hh%Mm%Ss")
30 d52a5b2f jenselme
31 d4c4525a Julien Enselme
for site in $(sites_list); do
32
    drush @"${site}" cc all
33
34
    dir=$(get_site_dir_from_name "${site}")
35
36 15ed27d8 Julien Enselme
    if [ "${mode}" = 'auto' ] ; then
37 2a0f9a31 Florent Torregrosa
        drush @"${site}" sql-dump --result-file="${d7_dir_individual_auto_backup}/${dir}/${current_date}.${dir}.sql" --gzip --structure-tables-key=common-d7
38 d52a5b2f jenselme
    else
39 2a0f9a31 Florent Torregrosa
        drush @"${site}" sql-dump --result-file="${d7_dir_individual_manual_backup}/${dir}/${current_date}.${dir}.sql" --gzip --structure-tables-key=common-d7
40 d52a5b2f jenselme
    fi
41
done