Last active
March 4, 2026 13:32
-
-
Save fryfrog/ee4a2a3a43a2a644e7c42e7f729664ca to your computer and use it in GitHub Desktop.
Revisions
-
fryfrog revised this gist
Jul 29, 2019 . No changes.There are no files selected for viewing
-
fryfrog renamed this gist
Jul 29, 2019 . 1 changed file with 0 additions and 0 deletions.There are no files selected for viewing
File renamed without changes. -
fryfrog created this gist
Jul 29, 2019 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,93 @@ #!/bin/bash ################################################################################ ### NZBGET POST-PROCESSING SCRIPT ### # Change user:group ownership and folder/file permission. ################################################################################ ### OPTIONS ### # Set owner and group (yes, no). setowner=no # Put user here. user=user # Put group here. group=group # Set folder and file permissions (yes, no). setmode=no # Put file mode here. mode=664 # Put folder mode here. dirmode=775 ### NZBGET POST-PROCESSING SCRIPT ### ################################################################################ # Exit codes #POSTPROCESS_PARCHECK=92 #POSTPROCESS_SUCCESS=93 POSTPROCESS_ERROR=94 #POSTPROCESS_NONE=95 POSTPROCESS=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 if [[ "${NZBPO_USER}" = "user" ]] || [[ "${NZBPO_GROUP}" = "group" ]]; then echo "*** NZBGet post-processing script ***" echo "[WARN] The user and group are set to defaults, check script settings." exit ${POSTPROCESS_ERROR} fi # Check if directory exists if [[ -d "${NZBPP_DIRECTORY}" ]]; then # chown if [[ "${NZBPO_SETOWNER}" = "yes" ]]; then if chown "${NZBPO_USER}:${NZBPO_GROUP}" -R "${NZBPP_DIRECTORY}"; then echo "[INFO] Ownership set to ${NZBPO_USER}:${NZBPO_GROUP}" POSTPROCESS=93 else echo "[WARN] User and group NOT set" exit ${POSTPROCESS_ERROR} fi fi # chmod if [[ "${NZBPO_SETMODE}" = "yes" ]]; then # recursively set perms on files if find "${NZBPP_DIRECTORY}" -type f -exec chmod "${NZBPO_MODE}" '{}' ';'; then echo "[INFO] File permissions set to ${NZBPO_MODE}" POSTPROCESS=93 else echo "[WARN] File permissions NOT set" exit ${POSTPROCESS_ERROR} fi # recursively set perms on folders if find "${NZBPP_DIRECTORY}" -type d -exec chmod "${NZBPO_DIRMODE}" '{}' ';'; then echo "[INFO] Folder permissions set to ${NZBPO_DIRMODE}" POSTPROCESS=93 else echo "[WARN] Folder permissions NOT set" exit ${POSTPROCESS_ERROR} fi fi else echo "[WARN] Directory not found" echo "[DETAIL] $NZBPP_DIRECTORY" exit ${POSTPROCESS} fi exit ${POSTPROCESS}