October 13, 201213 yr I'm not a total stranger to scripting / programming however I've spent near 20 year in dos/Win so linux commandline is learning as I go - keeping that i mind no insulting me if I missed something silly I've tried to knock up two scripts as 'user script' in unmenu. Firstly - Starts up each of the 4 download clients I run: #define USER_SCRIPT_LABEL Enable Media All Downloaders #define USER_SCRIPT_DESCR Start up Sabnzbd, Sickbeard, headphones and Couchpotato (as services) #UNMENU_RELEASE $Revision: 1 $ $Date: 2012-01-24 23:45:23 -0400 (Mon, 29 Mar 2010) $ echo "<pre>" echo "Start SABnzbd" /mnt/cache/.custom/sabnzbd/SABnzbd.py -d -s 192.168.0.29:88 echo "<pre>" echo "Start Sickbeard" /mnt/cache/.custom/sickbeard/SickBeard.py --daemon echo "<pre>" echo "Start CouchPotato" /mnt/cache/.custom/couchpotato/CouchPotato.py -d echo "<pre>" python /mnt/cache/.custom/headphones/Headphones.py -d echo "<pre>" echo "All Done" secondly - The same but to kill off all 4 downloaders #define USER_SCRIPT_LABEL Disable All Media Downloaders #define USER_SCRIPT_DESCR Shutdown Sabnzbd, Sickbeard,Headphones and Couchpotato #UNMENU_RELEASE $Revision: 1 $ $Date: 2012-01-24 23:45:23 -0400 (Mon, 29 Mar 2010) $ echo "<pre>" echo "shutting down Sabnzbd..." /usr/bin/wget -q --delete-after 'http://192.168.0.29:88/sabnzbd/shutdown?session=082f6413e07f0d7ebb8522e15cdeb130' echo "<pre>" echo "shutting down Sickbeard..." /usr/bin/wget -q --delete-after 'http://192.168.0.29:8081/home/shutdown/?pid=29419' echo "<pre>" echo "shutting down CouchPotato..." /usr/bin/wget -q --delete-after 'http://192.168.0.29:5000/config/exit/' echo "shutting down Headphones..." /usr/bin/wget -q --delete-after 'http://192.168.0.29:8181/shutdown/' echo "<pre>" echo "Done" Functionally both do there jobs just fine however, the enable downloaders script seems to kill off the unmenu service so rather then getting the output as the bottom of the page I get a blank page when the browser refreshes. After running the enable script the only way to get back into unmenu is to remote to console and do a /boo/unmenu/uu Any advice what I can check?
October 13, 201213 yr you seem to have a hard coded process ID in one of your scripts. The process is almost certainly not going to have the same PID each time it runs. Second, unMENU waits for ALL output from your scripts before returning the output to your browser. One of the commands is probably just not completing, or is prompting you for input before continuing., What happens when you run the exact same script on the command line? In other words, type /boot/unmenu/script_name and see what it does. Odds are the enable script is waiting for your services to complete before returning... And unMENU is waiting patiently as well. It is not enough to put the services in the background, as their output is still being waited for. You might try re-directing the output and error-output of each of the python commands to a log file, like this: /mnt/cache/.custom/sabnzbd/SABnzbd.py -d -s 192.168.0.29:88 1>>/var/log/sab_log.txt 2>&1 Joe L.
October 13, 201213 yr Author Well my initial testing on what worked was done by going to the commandline and just running the 'wget http://etc.etc.etc'. I've confirmed that each command runs fine, the application shutdown works fine and after each you get dropped back at the commandline so I'm pretty sure it isn't waiting on anything. That why i find it so strange it doesn't work. I've had to hardcore that process ID in for sickbeard as they have change the way shutdown works. A few versions back it just was 'http://etcetc/shutdown' but now its got the ID on the end. I'm going to bring that up on the sickbeard forums Same with Sabnzbd having some kind of session ID on the end, its never changed since I've been using it so I'm not sure what it relates to Where you have wrote 'It is not enough to put the services in the background, as their output is still being waited for' - what exactly do you mean by putting them in the background? I'm looking to kill them off
October 13, 201213 yr Well my initial testing on what worked was done by going to the commandline and just running the 'wget http://etc.etc.etc'. I've confirmed that each command runs fine, the application shutdown works fine and after each you get dropped back at the commandline so I'm pretty sure it isn't waiting on anything. That why i find it so strange it doesn't work. I've had to hardcore that process ID in for sickbeard as they have change the way shutdown works. A few versions back it just was 'http://etcetc/shutdown' but now its got the ID on the end. I'm going to bring that up on the sickbeard forums Same with Sabnzbd having some kind of session ID on the end, its never changed since I've been using it so I'm not sure what it relates to Where you have wrote 'It is not enough to put the services in the background, as their output is still being waited for' - what exactly do you mean by putting them in the background? I'm looking to kill them off When you are invoking them (starting them) you are using the -d flag, which I assume demonizes them. The error output still is sent to the invoking terminal/shell You must redirect it elsewhere for the unMENU script to not wait forever for it to finish. Joe L.
Archived
This topic is now archived and is closed to further replies.