-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy pathrds_sync.sh
More file actions
26 lines (22 loc) · 895 Bytes
/
Copy pathrds_sync.sh
File metadata and controls
26 lines (22 loc) · 895 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#!/bin/bash
replica1=master-replica-1.czzuhjvwmmvx.us-east-1.rds.amazonaws.com
replica2=master-replica-2.czzuhjvwmmvx.us-east-1.rds.amazonaws.com
user=admin
password=admin123
option=$1
if [[ -z "$option" ]]; then
echo "Invalid Input"
exit 1
fi
if [ $option == 'start' ]
then
mysql -u $user -p$password -h $replica1 -e "CALL mysql.rds_start_replication;"
mysql -u $user -p$password -h $replica2 -e "CALL mysql.rds_start_replication;"
rsync -av --exclude=wp-config.php /dev.efs_directory/ /var/www/html/
elif [ $option == 'stop' ]
then
mysql -u $user -p$password -h $replica1 -e "CALL mysql.rds_stop_replication;"
mysql -u $user -p$password -h $replica2 -e "CALL mysql.rds_stop_replication;"
else
echo "Wrong Input"
fi