diff options
| author | Laurent Cozic <laurent@cozic.net> | 2015-11-08 12:09:28 +0100 |
|---|---|---|
| committer | Laurent Cozic <laurent@cozic.net> | 2015-11-08 12:09:28 +0100 |
| commit | 2f2ac64aa3a782fdaec161e01e1ac92df81a631e (patch) | |
| tree | 97cd40f874c991063a26c634d7c949b2811826fd | |
| parent | b7d2cae0b39e7e9520bc2db5c331a97e6f3daf7d (diff) | |
'Fix' active backup task issue in Cygwin, added warning, and TODO solution
| -rwxr-xr-x[-rw-r--r--] | rsync_tmbackup.sh | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/rsync_tmbackup.sh b/rsync_tmbackup.sh index 6ca2b0f..0992d3c 100644..100755 --- a/rsync_tmbackup.sh +++ b/rsync_tmbackup.sh @@ -176,11 +176,18 @@ fi # ----------------------------------------------------------------------------- if [ -n "$(fn_find "$INPROGRESS_FILE")" ]; then - RUNNINGPID="$(fn_run_cmd "cat $INPROGRESS_FILE")" - if [ "$RUNNINGPID"="$(pgrep "$APPNAME")" ]; then - fn_log_error "Previous backup task is still active - aborting." - exit 1 - fi + if [ "$OSTYPE" == "cygwin" ]; then + # TODO: Cygwin reports the name of currently running Bash scripts as just "/usr/bin/bash" + # TODO: so the pgrep solution below won't work. Need to use "procps -wwFAH", grep + # TODO: the script name, and extract the process ID from it. + fn_log_warn "Cygwin only: Previous backup task has either been interrupted or it might still be active, but there is currently no check for this. Assuming that the task was simply interrupted." + else + RUNNINGPID="$(fn_run_cmd "cat $INPROGRESS_FILE")" + if [ "$RUNNINGPID"="$(pgrep "$APPNAME")" ]; then + fn_log_error "Previous backup task is still active - aborting." + exit 1 + fi + fi if [ -n "$PREVIOUS_DEST" ]; then # - Last backup is moved to current backup folder so that it can be resumed. |
