Add sleep

This commit is contained in:
Bob Mottram 2016-12-30 23:54:44 +00:00
parent a788b7e901
commit f0eb273dc6
1 changed files with 10 additions and 3 deletions

View File

@ -48,6 +48,7 @@ matrix_variables=(ONION_ONLY
DEFAULT_DOMAIN_NAME) DEFAULT_DOMAIN_NAME)
function matrix_nginx { function matrix_nginx {
matrix_changed=
matrix_proxy_str=' \ matrix_proxy_str=' \
location /matrix { \ location /matrix { \
proxy_pass https://localhost:8448; \ proxy_pass https://localhost:8448; \
@ -147,18 +148,25 @@ function matrix_nginx {
fi fi
nginx_ensite $DEFAULT_DOMAIN_NAME nginx_ensite $DEFAULT_DOMAIN_NAME
matrix_changed=1
fi fi
if ! grep "localhost:${MATRIX_PORT}" /etc/nginx/sites-available/${DEFAULT_DOMAIN_NAME}; then if ! grep "localhost:${MATRIX_PORT}" /etc/nginx/sites-available/${DEFAULT_DOMAIN_NAME}; then
sed -i "s|:443 ssl;|:443 ssl;${matrix_proxy_str}|g" /etc/nginx/sites-available/${DEFAULT_DOMAIN_NAME} sed -i "s|:443 ssl;|:443 ssl;${matrix_proxy_str}|g" /etc/nginx/sites-available/${DEFAULT_DOMAIN_NAME}
sed -i "s| default_server;| default_server;${matrix_proxy_str}|g" /etc/nginx/sites-available/${DEFAULT_DOMAIN_NAME} sed -i "s| default_server;| default_server;${matrix_proxy_str}|g" /etc/nginx/sites-available/${DEFAULT_DOMAIN_NAME}
matrix_changed=1
fi fi
if ! grep "localhost:${TURN_PORT}" /etc/nginx/sites-available/${DEFAULT_DOMAIN_NAME}; then if ! grep "localhost:${TURN_PORT}" /etc/nginx/sites-available/${DEFAULT_DOMAIN_NAME}; then
sed -i "s|:443 ssl;|:443 ssl;${turn_proxy_str}|g" /etc/nginx/sites-available/${DEFAULT_DOMAIN_NAME} sed -i "s|:443 ssl;|:443 ssl;${turn_proxy_str}|g" /etc/nginx/sites-available/${DEFAULT_DOMAIN_NAME}
sed -i "s| default_server;| default_server;${turn_proxy_str}|g" /etc/nginx/sites-available/${DEFAULT_DOMAIN_NAME} sed -i "s| default_server;| default_server;${turn_proxy_str}|g" /etc/nginx/sites-available/${DEFAULT_DOMAIN_NAME}
matrix_changed=1
fi
if [ $matrix_changed ]; then
systemctl restart nginx
sleep 5
fi fi
systemctl restart nginx
} }
function matrix_generate_synapse_file { function matrix_generate_synapse_file {
@ -247,9 +255,8 @@ function add_user_matrix {
${PROJECT_NAME}-pass -u $new_username -a matrix -p "$new_user_password" ${PROJECT_NAME}-pass -u $new_username -a matrix -p "$new_user_password"
read_config_param 'MATRIX_SECRET'
matrix_nginx matrix_nginx
register_new_matrix_user -c ${MATRIX_DATA_DIR}/homeserver.yaml -u "${new_username}" -p "${new_user_password}" -a retval=$(register_new_matrix_user -c ${MATRIX_DATA_DIR}/homeserver.yaml -u "${new_username}" -p "${new_user_password}" -a)
echo "0" echo "0"
} }