From 2ba179ca7dc4ff910728c73878ac09eb7475c463 Mon Sep 17 00:00:00 2001 From: "William D. Jones" Date: Tue, 12 Jun 2018 13:33:21 +0000 Subject: Add NetBSD date parsing. --- rsync_tmbackup.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/rsync_tmbackup.sh b/rsync_tmbackup.sh index 63a863f..3a634f8 100755 --- a/rsync_tmbackup.sh +++ b/rsync_tmbackup.sh @@ -59,6 +59,7 @@ fn_parse_date() { case "$OSTYPE" in linux*) date -d "${1:0:10} ${1:11:2}:${1:13:2}:${1:15:2}" +%s ;; cygwin*) date -d "${1:0:10} ${1:11:2}:${1:13:2}:${1:15:2}" +%s ;; + netbsd*) date -d "${1:0:10} ${1:11:2}:${1:13:2}:${1:15:2}" +%s ;; darwin8*) yy=`expr ${1:0:4}` mm=`expr ${1:5:2} - 1` dd=`expr ${1:8:2}` -- cgit v1.2.3 From 487fd112c11f29b25f2c4a34d0cccf36a713a97e Mon Sep 17 00:00:00 2001 From: "William D. Jones" Date: Wed, 13 Jun 2018 14:11:27 +0000 Subject: Use NetBSD ps in place of pgrep to determine whether a backup is currently running. --- rsync_tmbackup.sh | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/rsync_tmbackup.sh b/rsync_tmbackup.sh index 3a634f8..a8723e7 100755 --- a/rsync_tmbackup.sh +++ b/rsync_tmbackup.sh @@ -370,6 +370,12 @@ if [ -n "$(fn_find "$INPROGRESS_FILE")" ]; then fn_log_error "Previous backup task is still active - aborting (command: $RUNNINGCMD)." exit 1 fi + elif [[ "$OSTYPE" == "netbsd"* ]]; then + RUNNINGPID="$(fn_run_cmd "cat $INPROGRESS_FILE")" + if ps -axp "$RUNNINGPID" -o "command" | grep "$APPNAME" > /dev/null; then + fn_log_error "Previous backup task is still active - aborting." + exit 1 + fi else RUNNINGPID="$(fn_run_cmd "cat $INPROGRESS_FILE")" if [ "$RUNNINGPID" = "$(pgrep -o -f "$APPNAME")" ]; then -- cgit v1.2.3