Projet

Général

Profil

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

root / bin / d7-all-dump-individual.sh @ 7d7b5830

1
#!/bin/sh
2

    
3
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
	    mode="${OPTARG}";;
15
	:)
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
. /home/assos/bin/scripts-config.sh
26
. scripts-utils.sh
27

    
28

    
29
current_date=$(date "+%Y-%m-%d-%Hh%Mm%Ss")
30

    
31
cd "${d7_dir_sites}"
32

    
33
for dir in $(find . -maxdepth 1 -mindepth 1 -type d ! -name all | cut -c3-); do
34
    cd "${dir}"
35
    drush cc all
36
    if [ "${mode}" = 'auto' ] ; then
37
        drush sql-dump --result-file="${d7_dir_individual_auto_backup}/${dir}/${current_date}.${dir}.sql" --gzip
38
    else
39
        drush sql-dump --result-file="${d7_dir_individual_manual_backup}/${dir}/${current_date}.${dir}.sql" --gzip
40
    fi
41
    cd -
42
done