Révision e71cae50
Ajouté par Julien Enselme il y a environ 10 ans
other-scripts/d7-sync.sh | ||
---|---|---|
2 | 2 |
|
3 | 3 |
help=<<EOF |
4 | 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 |
It relies on bash, drush and requires a valid d7-sync-config.sh. You must have |
|
6 |
configured SSH so that ssh webassos connects you to the webserver. |
|
6 | 7 |
The drupal installation is synched using git, the website files and database using rsync. |
7 | 8 |
|
8 | 9 |
usage: d7-sync.sh [SITENAME] |
... | ... | |
15 | 16 |
### Init |
16 | 17 |
# Config |
17 | 18 |
source d7-sync-config.sh || source d7-sync-config.example.sh |
18 |
source d7-sync-functions.sh |
|
19 |
source ~/.bashrc |
|
20 |
shopt -s expand_aliases |
|
21 | 19 |
cd $DIR_MULTIASSOS |
22 | 20 |
ret=$? |
23 | 21 |
if [ $ret -ne 0 ] ; then |
... | ... | |
54 | 52 |
|
55 | 53 |
mkdir $dir_site |
56 | 54 |
cd $dir_site |
57 |
rsync_from_assos -rltp --progress --delete drupal7/sites/$dir_site/ .
|
|
55 |
rsync -rltp --progress --delete $WEBASSOS_ID:drupal7/sites/$dir_site/ .
|
|
58 | 56 |
# Change permissions for Apache |
59 | 57 |
# TODO: do something less permissive than 755 |
60 | 58 |
chmod -R 755 . |
... | ... | |
65 | 63 |
now=$(date +%s) |
66 | 64 |
sql_file="$1.$now.sql" |
67 | 65 |
remote_sql_file="$REMOTE_DIR_TMP_SAS/$sql_file" |
68 |
assos "drush @$1 sql-dump > $remote_sql_file"
|
|
69 |
scp $SSH_ID_SAS:$remote_sql_file .
|
|
66 |
ssh $WEBASSOS_ID "drush @$1 sql-dump > $remote_sql_file"
|
|
67 |
scp $WEBASSOS_ID:$remote_sql_file .
|
|
70 | 68 |
mysql -u root -e "DROP DATABASE IF EXISTS $local_db_name; CREATE DATABASE $local_db_name" |
71 | 69 |
ret=$? |
72 | 70 |
if [ $ret -ne 0 ] ; then |
... | ... | |
77 | 75 |
fi |
78 | 76 |
mysql -u root $local_db_name < $sql_file |
79 | 77 |
rm $sql_file |
80 |
assos "rm $remote_sql_file"
|
|
78 |
ssh $WEBASSOS_ID "rm $remote_sql_file"
|
|
81 | 79 |
|
82 | 80 |
### modify settings.php |
83 | 81 |
python3 $DIR_MULTIASSOS/other-scripts/modify-settings.py settings.local.php --baseurl $base_url --database $local_db_name |
Formats disponibles : Unified diff
Change script so that the wrapper around functions are not needed any more. Use ProxyCommand in ~/.ssh/config