From 82cabb16b3a57090368e1be9947be9bd46af9a16 Mon Sep 17 00:00:00 2001
From: Einar Forselv <eforselv@gmail.com>
Date: Thu, 18 Apr 2019 05:44:59 +0200
Subject: [PATCH] Ensure backup process actions don't happen in the main
 container

---
 restic_volume_backup/cli.py | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/restic_volume_backup/cli.py b/restic_volume_backup/cli.py
index 7417339..a00ab40 100644
--- a/restic_volume_backup/cli.py
+++ b/restic_volume_backup/cli.py
@@ -27,8 +27,8 @@ def status(config, containers):
     """Outputs the backup config for the compse setup"""
     print()
     print("Backup config for compose project '{}'".format(containers.this_container.project_name))
-    print("Backup service:", containers.this_container.name)
-    print("Backup process:", containers.backup_process_container.name \
+    print("Current service:", containers.this_container.name)
+    print("Backup process :", containers.backup_process_container.name \
         if containers.backup_process_container else 'Not Running')
 
     print()
@@ -67,6 +67,13 @@ def backup(config, containers):
 
 def start_backup_process(config, containers):
     """Start the backup process container"""
+    if not containers.backup_process_container or containers.this_container == containers.backup_process_container is False:
+        print(
+            "Cannot run backup process in this container. Use backup command instead. "
+            "This will spawn a new container with the necessary mounts."
+        )
+        return
+
     print("start-backup-process")
     status(config, containers)