Page 1 of 1

No arguments to script on queue finishing

Posted: August 14th, 2010, 5:34 am
by doncroco
Hello,

I am trying to set up a script on finishing queue, but I have a problem with the arguments. It seems that no arguments are passed to the script. Here is the script :

Code: Select all

#!/bin/sh

echo
echo "Started as $0" > /tmp/notify_rabbit.txt
echo "Number of arguments : $#" >> /tmp/notify_rabbit.txt
echo "All arguments : $* " >> /tmp/notify_rabbit.txt
echo "And this arguments : $@ " >> /tmp/notify_rabbit.txt
echo "The first parameter (result-dir)  =" "$1" >> /tmp/notify_rabbit.txt
echo "The second parameter (nzb-name)   =" "$2" >> /tmp/notify_rabbit.txt
echo "The third parameter (nice name)   =" "$3" >> /tmp/notify_rabbit.txt
echo "The fourth parameter (newzbin-id) =" "$4" >> /tmp/notify_rabbit.txt
echo "The fifth parameter (category)    =" "$5" >> /tmp/notify_rabbit.txt
echo "The sixth parameter (group)       =" "$6" >> /tmp/notify_rabbit.txt
echo "The seventh parameter (status)    =" "$7" >> /tmp/notify_rabbit.txt
echo "Env : " >> /tmp/notify_rabbit.txt
env  >> /tmp/notify_rabbit.txt
Here is the result :

Code: Select all

Number of arguments : 0
All arguments :  
And this arguments :  
The first parameter (result-dir)  = 
The second parameter (nzb-name)   = 
The third parameter (nice name)   = 
The fourth parameter (newzbin-id) = 
The fifth parameter (category)    = 
The sixth parameter (group)       = 
The seventh parameter (status)    = 
Env : 
SUDO_GID=1000
MAIL=/var/mail/don
HOME=/home/don
DPKG_MAINTSCRIPT_ARCH=all
SUDO_UID=1000
LOGNAME=root
DPKG_RUNNING_VERSION=1.15.5.6ubuntu2
TERM=xterm-color
USERNAME=root
PATH=/sbin:/usr/sbin:/bin:/usr/bin
LANG=fr_FR
DPKG_MAINTSCRIPT_PACKAGE=sabnzbdplus
SUDO_COMMAND=/usr/bin/aptitude safe-upgrade
SHELL=/bin/bash
SUDO_USER=don
DPKG_NO_TSTP=yes
PWD=/usr/bin
I am running sabnzbd version 0.5.3, from ubuntu 10.04 packages.

Any advice ?

Re: No arguments to script on queue finishing

Posted: August 14th, 2010, 9:14 am
by shypike
Hard to tell.
What happens if you run the supplied sample script Sample-PostProc.sh ?
(It's in SABnzbd program folder).

Re: No arguments to script on queue finishing

Posted: August 15th, 2010, 12:00 pm
by doncroco
In fact, it's nearly the sample script. So the result is the same.

Re: No arguments to script on queue finishing

Posted: August 15th, 2010, 5:03 pm
by shypike
I just tested on Ubuntu 10.4, with the "official" package for SABnzbd-0.5.0.
It works fine with Sample-PostProc.sh
0.5.3 from sources, works too.
Can you check in the log file what is passed to the script (you may need to set log level to "debug") ?
Search for "Running external script".
The line should show the full script path and a comma-separated list of parameters.