summaryrefslogtreecommitdiff
path: root/archlinuxaba/bareos/check-if-bareos-backup-is-running
diff options
context:
space:
mode:
Diffstat (limited to 'archlinuxaba/bareos/check-if-bareos-backup-is-running')
-rwxr-xr-xarchlinuxaba/bareos/check-if-bareos-backup-is-running19
1 files changed, 19 insertions, 0 deletions
diff --git a/archlinuxaba/bareos/check-if-bareos-backup-is-running b/archlinuxaba/bareos/check-if-bareos-backup-is-running
new file mode 100755
index 0000000..bc3d2e1
--- /dev/null
+++ b/archlinuxaba/bareos/check-if-bareos-backup-is-running
@@ -0,0 +1,19 @@
+#!/bin/bash
+
+if [ $# -ne 0 ]; then
+ >&2 echo 'check-if-bareos-backup-is-running: too many arguments'
+ exit 2
+fi
+
+if cat /proc/net/tcp* \
+| awk '{print $2 " " $3}' \
+| grep -vw '\(000000000000000000000000\)\?00000000:0000' \
+| tr ' ' '\n' \
+| grep -F : \
+| cut -d: -f2 \
+| grep -qxiF '238F'; then
+ >&2 echo 'bareos-fd is connected to bareos-sd'
+ exit 1
+else
+ >&2 echo 'bareos-fd is not connected to bareos-sd'
+fi