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
|
. /home/assos/bin/scripts-utils.sh
|
27
|
|
28
|
|
29
|
current_date=$(date "+%Y-%m-%d-%Hh%Mm%Ss")
|
30
|
|
31
|
for site in $(sites_list); do
|
32
|
drush @"${site}" cc all
|
33
|
|
34
|
dir=$(get_site_dir_from_name "${site}")
|
35
|
|
36
|
if [ "${mode}" = 'auto' ] ; then
|
37
|
drush @"${site}" sql-dump --result-file="${d7_dir_individual_auto_backup}/${dir}/${current_date}.${dir}.sql" --gzip
|
38
|
else
|
39
|
drush @"${site}" sql-dump --result-file="${d7_dir_individual_manual_backup}/${dir}/${current_date}.${dir}.sql" --gzip
|
40
|
fi
|
41
|
done
|