Révision f6a5e032
Ajouté par Julien Enselme il y a environ 10 ans
other-scripts/d7-sync.sh | ||
---|---|---|
1 | 1 |
#!/usr/bin/env bash |
2 | 2 |
|
3 | 3 |
help=<<EOF |
4 |
This script is intended to ease the synchronisation of any site hosted by assos. It relies on bash, drush and requires @ssh assos@ to work. |
|
4 |
This script is intended to ease the synchronisation of any site hosted by assos. |
|
5 |
It relies on bash, drush and requires a valid d7-sync-config.sh. |
|
5 | 6 |
The drupal installation is synched using git, the website files and database using rsync. |
6 | 7 |
|
7 | 8 |
usage: d7-sync.sh [SITENAME] |
... | ... | |
50 | 51 |
|
51 | 52 |
mkdir $dir_site |
52 | 53 |
cd $dir_site |
53 |
rsync -rltp --progress --delete assos:~/drupal7/sites/$dir_site/* .
|
|
54 |
rsync_from_assos -rltp --progress --delete ~/drupal7/sites/$dir_site/* .
|
|
54 | 55 |
# Change permissions for Apache |
55 | 56 |
# TODO: do something less permissive than 755 |
56 | 57 |
chmod -R 755 . |
... | ... | |
61 | 62 |
now=$(date +%s) |
62 | 63 |
sql_file="$1.$now.sql" |
63 | 64 |
remote_sql_file="~/tmp/$sql_file" |
64 |
ssh assos "drush @$1 sql-dump > $remote_sql_file"
|
|
65 |
scp assos:$remote_sql_file .
|
|
65 |
assos "drush @$1 sql-dump > $remote_sql_file" |
|
66 |
scp_from_assos $remote_sql_file .
|
|
66 | 67 |
mysql -u root -e "DROP DATABASE IF EXISTS $local_db_name; CREATE DATABASE $local_db_name" |
67 | 68 |
ret=$? |
68 | 69 |
if [ $ret -ne 0 ] ; then |
69 | 70 |
echo "mysql daemon is not started. Exiting." |
70 |
ssh assos "rm $remote_sql_file"
|
|
71 |
assos "rm $remote_sql_file" |
|
71 | 72 |
rm $sql_file |
72 | 73 |
exit 1 |
73 | 74 |
fi |
74 | 75 |
mysql -u root $local_db_name < $sql_file |
75 | 76 |
rm $sql_file |
76 |
ssh assos "rm $remote_sql_file"
|
|
77 |
assos "rm $remote_sql_file" |
|
77 | 78 |
|
78 | 79 |
### modify settings.php |
79 | 80 |
python3 $DIR_MULTIASSOS/other-scripts/modify-settings.py settings.local.php --baseurl $base_url --database $local_db_name |
... | ... | |
88 | 89 |
drush status > /dev/null |
89 | 90 |
ret=$? |
90 | 91 |
if [ $ret -ne 0 ] ; then |
91 |
echo "drush or site has a problem. Exiting" |
|
92 |
echo "drush or site has a problem. Exiting."
|
|
92 | 93 |
exit 1 |
93 | 94 |
fi |
94 | 95 |
drush -y dis piwik |
Formats disponibles : Unified diff
Update d7-sync.sh and d7-sync-config.example.sh so they can work with webassos.ec-m.fr