summaryrefslogtreecommitdiff
path: root/bareos/check-if-bareos-backup-is-running
diff options
context:
space:
mode:
authorErich Eckner <git@eckner.net>2020-03-30 22:07:50 +0200
committerErich Eckner <git@eckner.net>2020-03-30 22:07:50 +0200
commit5c5ca001eaad2ca557fa93e23798d40edaa989eb (patch)
tree687d3035d991ab3e2ddb923a03bf536be5f21ef3 /bareos/check-if-bareos-backup-is-running
parentf212e0f7b07d9777fb3682676b45b8b3c078fcde (diff)
downloadarchlinuxewe-5c5ca001eaad2ca557fa93e23798d40edaa989eb.tar.xz
bareos: 19.2.6-10 -> 19.2.6-11
Diffstat (limited to 'bareos/check-if-bareos-backup-is-running')
-rwxr-xr-xbareos/check-if-bareos-backup-is-running49
1 files changed, 7 insertions, 42 deletions
diff --git a/bareos/check-if-bareos-backup-is-running b/bareos/check-if-bareos-backup-is-running
index e638869df..ea7cc3aff 100755
--- a/bareos/check-if-bareos-backup-is-running
+++ b/bareos/check-if-bareos-backup-is-running
@@ -5,46 +5,11 @@ if [ $# -ne 0 ]; then
exit 2
fi
-bareos_pid=$(
- pgrep -xf '(.*/)?bareos-fd' \
- | head -n1
-)
-
-if [ -z "${bareos_pid}" ]; then
- >&2 echo 'check-if-bareos-backup-is-running: cannot find running bareos-fd'
- exit 2
-fi
-
-if ! grep -qxF bareos-fd "/proc/${bareos_pid}/comm"; then
- >&2 echo 'check-if-bareos-backup-is-running: cannot find running bareos-fd'
- exit 2
+if awk '{print $3}' /proc/net/tcp \
+| cut -d: -f2 \
+| grep -qxiF '238F'; then
+ >&2 echo 'bareos-fd is not connected to bareos-sd'
+else
+ >&2 echo 'bareos-fd is connected to bareos-sd'
+ exit 1
fi
-
-if [ $(whoami) != 'root' ]; then
- >&2 echo 'check-if-bareos-backup-is-running: must be run as root'
- exit 2
-fi
-
-time_out=$((
- $(date +%s)+30
-))
-was=$(
- sed '
- s/^read_bytes: //
- t
- d
- ' "/proc/${bareos_pid}/io"
-)
-while [ $(date +%s) -le ${time_out} ]; do
- sleep 1
- if sed '
- s/^read_bytes: //
- t
- d
- ' "/proc/${bareos_pid}/io" \
- | grep -qvxF "${was}"; then
- >&2 echo 'bareos-fd is reading'
- exit 1
- fi
-done
->&2 echo 'bareos-fd is not reading'