#!/usr/bin/sh # # NCFtp post-processing script for NZBGet # # Copyright (C) 2012-2013 picard # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see . # ############################################################################## ### NZBGET POST-PROCESSING SCRIPT ### # FTP copy from NZBGet to Target. # NOTE: This script requires NCFTP to be installed on your system. ############################################################################## ### OPTIONS ### # Set here the full path for your FTP Server. Dir=/admin/download/fertig/ # Put your FTP Server or ip here. Server=nsa310 # Put your FTP Username here. Username=myusername # Put your FTP password here. Password=mypassword # Set it to delete the collection after copy (yes, no). Delete=yes ### NZBGET POST-PROCESSING SCRIPT ### ############################################################################## # Exit codes POSTPROCESS_PARCHECK=92 POSTPROCESS_SUCCESS=93 POSTPROCESS_ERROR=94 POSTPROCESS_NONE=95 # Check if the script is called from nzbget 11.0 or later if [ "$NZBOP_SCRIPTDIR" = "" ]; then echo "*** NZBGet post-processing script ***" echo "This script is supposed to be called from nzbget (11.0 or later)." exit $POSTPROCESS_ERROR fi # Check if par-check or unpack-failt if [ "$NZBPP_PARSTATUS" -eq 1 -o "$NZBPP_UNPACKSTATUS" -eq 1 ]; then echo "[ERROR] This nzb-file has failure status (par-check or unpack failed)" exit $POSTPROCESS_ERROR fi echo "[DETAIL] Script successfully started" cd "$NZBPP_DIRECTORY" # Check nzbget.conf options BadConfig=0 # All checks done, now doing the ftp job echo "[INFO] transfer will start to $NZBPO_SERVER...!" if (ncftpput -d /tmp/ncftpput.log -m -R -u "$NZBPO_USERNAME" -p "$NZBPO_PASSWORD" "$NZBPO_SERVER" "$NZBPO_DIR" "$NZBPP_DIRECTORY"); then echo "[INFO] transfer from $NZBPP_DIRECTORY to $NZBPO_SERVER successful." else echo "[ERROR] transfer from $NZBPP_DIRECTORY to $NZBPO_SERVER failed!" exit $POSTPROCESS_ERROR fi if [ "$Delete" = "yes" ]; then if (rm -rf "$NZBPP_DIRECTORY"); then echo "[INFO] Collection $NZBPP_DIRECTORY have been deleted." fi fi echo "[DETAIL] Script successfully end" # All OK exit $POSTPROCESS_SUCCESS