diff --git a/scripts/install b/scripts/install index 3af0053..9644bd1 100644 --- a/scripts/install +++ b/scripts/install @@ -135,7 +135,9 @@ ynh_systemd_action --service_name=$mongodb_servicename --action=restart sleep 10 -ynh_exec_warn_less ynh_mongo_exec --command="printjson(rs.initiate())" --eval +if ynh_exec_warn_less ynh_mongo_exec --command="printjson(rs.status())" | grep -q "no replset config has been received"; then + ynh_exec_warn_less ynh_mongo_exec --command="printjson(rs.initiate())" --eval +fi #============================================== # INSTALL ROCKETCHAT diff --git a/scripts/restore b/scripts/restore index 400c74f..3a68deb 100644 --- a/scripts/restore +++ b/scripts/restore @@ -103,7 +103,9 @@ ynh_systemd_action --service_name=$mongodb_servicename --action=restart sleep 10 -ynh_exec_warn_less ynh_mongo_exec --command="printjson(rs.initiate())" --eval +if ynh_exec_warn_less ynh_mongo_exec --command="printjson(rs.status())" | grep -q "no replset config has been received"; then + ynh_exec_warn_less ynh_mongo_exec --command="printjson(rs.initiate())" --eval +fi #================================================= # RESTORE SYSTEMD diff --git a/scripts/upgrade b/scripts/upgrade index 07fdd70..3f5619e 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -132,7 +132,9 @@ ynh_systemd_action --service_name=$mongodb_servicename --action=restart sleep 10 -ynh_exec_warn_less ynh_mongo_exec --command="printjson(rs.initiate())" --eval +if ynh_exec_warn_less ynh_mongo_exec --command="printjson(rs.status())" | grep -q "no replset config has been received"; then + ynh_exec_warn_less ynh_mongo_exec --command="printjson(rs.initiate())" --eval +fi #============================================== # INSTALL ROCKETCHAT