From 44c573d982cbd2f2bf39cebbd03eb21e8814312b Mon Sep 17 00:00:00 2001 From: Clinton Hall Date: Sun, 24 Mar 2013 20:09:46 -0700 Subject: [PATCH] reprocess when directory already deleted. Need to be careful not to delete or move everything in this case. --- .../current-stable/nzbget-postprocess.sh | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/nzbget-postprocessing-files/current-stable/nzbget-postprocess.sh b/nzbget-postprocessing-files/current-stable/nzbget-postprocess.sh index 323f0437..465a14ce 100644 --- a/nzbget-postprocessing-files/current-stable/nzbget-postprocess.sh +++ b/nzbget-postprocessing-files/current-stable/nzbget-postprocess.sh @@ -191,12 +191,13 @@ do_exit() { if [ "$Debug" = "yes" ]; then echo "[DETAIL] Post-Process: Executing function 'do_exit' with argument $1" | tee -a $tmplog; fi nzbStatus=0 if [ "$1" -ne "$POSTPROCESS_SUCCESS" ]; then - cd $NZBPP_DIRECTORY - if [ "$Delete_Failed" = "yes" -a "$NZBPP_DIRECTORY" != "$ConfigDir" ]; then + if [ "$Delete_Failed" = "yes" -a "$NZBPP_DIRECTORY" != "$ConfigDir" -a -d "$NZBPP_DIRECTORY" ]; then + cd $NZBPP_DIRECTORY rm * >/dev/null 2>&1 cd .. rmdir $NZBPP_DIRECTORY - elif [ "$NZBPP_DIRECTORY" != "$ConfigDir" -a "$Failed_Directory" != "" ]; then + elif [ "$NZBPP_DIRECTORY" != "$ConfigDir" -a "$Failed_Directory" != "" -a -d "$NZBPP_DIRECTORY" ]; then + cd $NZBPP_DIRECTORY mkdir $Failed_Directory mkdir $Failed_Directory/$NZBPP_CATEGORY mv * $Failed_Directory/$NZBPP_CATEGORY >/dev/null 2>&1