I've been trying to write a simple bash script that would send me an SMS for each successful download. The SMS must contain the item name.
This script is a bit "special", indeed, I send SMS via proprietary API offered by my mobile phone provide (French company called, Free).
The API looks like this, you have to ping the following URL (with the right user / pass and wanted message):
So far the script is not working, I will explain issues below.
There is a working python version (post below), thanks to JVM.
Code: Select all
#!/bin/sh ### NZBGET POST-PROCESSING SCRIPT # This script sends an SMS containing item name each time a download is successful. # if using variables.... USER=123456 PASS=R4ND0M_STUFF MESSAGE="$NZBPP_NZBNAME" COMMAND="https://smsapi.free-mobile.fr/sendmsg?user=$USER&pass=$PASS&msg=$MESSAGE" echo $COMMAND # Exit codes POSTPROCESS_PARCHECK_CURRENT=91 POSTPROCESS_PARCHECK_ALL=92 POSTPROCESS_SUCCESS=93 POSTPROCESS_ERROR=94 POSTPROCESS_NONE=95 # Check if the script is called from nzbget if [ "$NZBPP_DIRECTORY" = "" -o "$NZBOP_CONFIGFILE" = "" ]; then echo "*** NZBGet post-process script ***" echo "This script is supposed to be called from nzbget (0.7.0 or later)." exit $POSTPROCESS_ERROR fi # Check if postprocessing was disabled in postprocessing parameters # (for current nzb-file) via web-interface or via command line with # "nzbget -E G O PostProcess=no <ID>" if [ "$NZBPR_PostProcess" = "no" ]; then echo "[WARNING] Post-Process: Postprocessing disabled for this nzb-file, exiting" exit $POSTPROCESS_NONE fi echo "[INFO] Post-Process: Post-process script successfully started" if [ "$NZBPP_PARSTATUS" -eq 2 -o "$NZBPP_UNPACKSTATUS" -eq 2 ]; then /usr/bin/curl -sk $COMMAND echo "[INFO] SMS sent to $USER." exit $POSTPROCESS_SUCCESS fi