summaryrefslogtreecommitdiff
path: root/bareos/check-if-bareos-backup-is-running
blob: bc3d2e10434a9e870bdf45d7469d0c220c34da81 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
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