From 9cc46019e72abe6c110265fe3b5f5a7d80439086 Mon Sep 17 00:00:00 2001 From: Erich Eckner Date: Sun, 26 Apr 2020 22:18:27 +0200 Subject: bareos-filedaemon: check-if-bareos-backup-is-running fixed --- manualPorts/bareos-filedaemon/.md5sum | 2 +- manualPorts/bareos-filedaemon/.signature | 6 +-- manualPorts/bareos-filedaemon/Pkgfile | 2 +- .../check-if-bareos-backup-is-running | 53 +++++----------------- 4 files changed, 16 insertions(+), 47 deletions(-) (limited to 'manualPorts/bareos-filedaemon') diff --git a/manualPorts/bareos-filedaemon/.md5sum b/manualPorts/bareos-filedaemon/.md5sum index 9f69f93..928a74e 100644 --- a/manualPorts/bareos-filedaemon/.md5sum +++ b/manualPorts/bareos-filedaemon/.md5sum @@ -1,4 +1,4 @@ d483ef56350c55492f916ce53798d377 19.2.7.tar.gz fd2649251216156c0ecce55aa1358411 bareos-fd -c0ff9a74d0e26f65122ecf3bb48a87bd check-if-bareos-backup-is-running +6ed62ade9d9843773f6089f0a10af731 check-if-bareos-backup-is-running 4f26be549cf136364dcb08daab7b0724 nullify-os-specifics.patch diff --git a/manualPorts/bareos-filedaemon/.signature b/manualPorts/bareos-filedaemon/.signature index ee84d7b..19794be 100644 --- a/manualPorts/bareos-filedaemon/.signature +++ b/manualPorts/bareos-filedaemon/.signature @@ -1,8 +1,8 @@ untrusted comment: verify with /etc/ports/deepthought.pub -RWQxCptPusLGGgV48CYNiT9TJ7FYP7unDwodGNYDq0cYem5xZitH3OdC/GjeuCFztwcMgZVMvKdpsuSDAlkCXDB53FJ/7G5JcAc= -SHA256 (Pkgfile) = a900db5d617e290f0ef3e5cc348a02e701146e1ac3aec490678a27cbfdc8540b +RWQxCptPusLGGgjDCFUhqDpxk5lHXwR8Q5ZHMhNBSLjucj+VtmkvFgRUymrk28DAN6EcT3b6qz8rg6nBop7lmUVhp99bbzhL5AY= +SHA256 (Pkgfile) = 41696837e009386c82012aa78dc3eb33c3de5c2cb2b01ae88d6bfed25747c1ac SHA256 (.footprint) = e2866d153999c5aa13bf8081e8dae03bde286930005d126eafc18778f2f38ca4 SHA256 (19.2.7.tar.gz) = 283c1fa9cb6a96b1f09b402cd507ecd8bf798458bafcbfad867da08d33d12653 SHA256 (nullify-os-specifics.patch) = d2c0943243aa6f8be7fe0548b2c160cbfb86c979ef535553b7d823dc7ab5462e -SHA256 (check-if-bareos-backup-is-running) = 14fb81b235a18c31f8457d23c525b4a87a0399755535f883d0f6e1e7fa360fc0 +SHA256 (check-if-bareos-backup-is-running) = caffce4f74f6e58c0b4e5b643643ba968de794afe04961794489cf70f39725d5 SHA256 (bareos-fd) = e70e265d19345d1971822288ca27a6f4322bcda0079d3371b3199e11a9947f36 diff --git a/manualPorts/bareos-filedaemon/Pkgfile b/manualPorts/bareos-filedaemon/Pkgfile index 098b344..3d0bf6a 100644 --- a/manualPorts/bareos-filedaemon/Pkgfile +++ b/manualPorts/bareos-filedaemon/Pkgfile @@ -6,7 +6,7 @@ name=bareos-filedaemon _name=${name%-*} version=19.2.7 -release=2 +release=3 source=("https://github.com/$_name/$_name/archive/Release/$version.tar.gz" 'nullify-os-specifics.patch' 'check-if-bareos-backup-is-running' diff --git a/manualPorts/bareos-filedaemon/check-if-bareos-backup-is-running b/manualPorts/bareos-filedaemon/check-if-bareos-backup-is-running index e638869..bc3d2e1 100755 --- a/manualPorts/bareos-filedaemon/check-if-bareos-backup-is-running +++ b/manualPorts/bareos-filedaemon/check-if-bareos-backup-is-running @@ -5,46 +5,15 @@ 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 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 - -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' -- cgit v1.2.3-70-g09d2