ceph backup script starts stopped ceph-mon
Check ceph-mon status first and then if needed
stops and starts ceph-mon during backup process.
Change-Id: I75b4f0aacbba9a55406ecb06845df9fa1d0331a9
Related-Prod: PROD-32288
diff --git a/ceph/files/backup/ceph-backup-client-runner.sh b/ceph/files/backup/ceph-backup-client-runner.sh
index 971f944..4b5b4f9 100644
--- a/ceph/files/backup/ceph-backup-client-runner.sh
+++ b/ceph/files/backup/ceph-backup-client-runner.sh
@@ -45,9 +45,13 @@
rsync -arv --exclude=osd/{{ common.get('cluster_name', 'ceph') }}-*/current /var/lib/ceph $TMPDIR/{{ common.get('cluster_name', 'ceph') }}-$HOSTNAME/
{%- elif mon.get('enabled', False) %}
cp -a /etc/ceph/ $TMPDIR/
- service ceph-mon@$HOSTNAME stop
- cp -a /var/lib/ceph/ $TMPDIR/{{ common.get('cluster_name', 'ceph') }}-$HOSTNAME/
- service ceph-mon@$HOSTNAME start
+ if service ceph-mon@$HOSTNAME status >/dev/null; then
+ service ceph-mon@$HOSTNAME stop
+ cp -a /var/lib/ceph/ $TMPDIR/{{ common.get('cluster_name', 'ceph') }}-$HOSTNAME/
+ service ceph-mon@$HOSTNAME start
+ else
+ cp -a /var/lib/ceph/ $TMPDIR/{{ common.get('cluster_name', 'ceph') }}-$HOSTNAME/
+ fi
{%- endif %}
tar -cvzf $BACKUPDIR/$HOSTNAME/{{ common.get('cluster_name', 'ceph') }}-$HOSTNAME-$TIMESTAMP.tgz $TMPDIR