Tuesday 5 March 2013

Newznab, Tmux, Backfill & Running on boot (Phew!)

Too many things to type in everytime you reboot your server? Want to backfill a buttload of nzb's you've torrented or been given? Follow the guide below, it automates everything into 1 script & then using tmux shows what's happening:

Step 1:


Postprocess script.

This script only does postprocessing. By default update_releases.php post processes the last 100 releases. if you backfill or if your update_releases.php has more than 100 releases some may not process. This script is to be run in another shell and only does post processing on releases that have not been done yet. when there is nothing to to it looks like it is hung but if you have more releases the script continues. Another rational is that it allows update_releases to finish quicker because the number of post processing it does is changed to 1.


nano +333 /var/www/newznab/www/lib/postprocess.php << change the 100 to a 1.

link to script download (place in update_scripts) justpostprocess

chmod 755 justpostprocessing.php << you can now run this script in a another shell.


Step 2:

The requirements to run this are as follows:

you must have followed the instructions for the Post-Processing script (above)
you must have installed sysstat (apt-get install sysstat)
you must have instaled ifstat (apt-get install ifstat)
you must have a basic understanding of how Tmux works (really really basic if you follow this guide :-)

Step 3:

If you go to your newznab installation folder, (mine for future reference is /var/www/newznab) and look in the misc/testing folder. You’ll see a script called nzb-importmodified.php. Copy that to /where/your/newznab/is/www/admin:

cp /where/your/newznab/is/misc/testing/nzb-importmodified.php /where/your/newznab/is/www/admin

Go to your screen script (or batch script on windows, then nano (or your choice of editor):

nano /where/your/newznab/is/misc/update_scripts/nix_scripts/newznab_screen.sh

Inside there, you should add a reference to your new import modified, with a link to where your nzbs are stored. Here is what my newznab_screen.sh looks like:


By adding true to the end of the request, it uses the name from the NZB file and doesn’t re-look it up.

create a folder in /var/www/newznab - mkdir tempnzbs 
(This is where you would store any nzb's you want to do a backfill import on....)

Step 4:

Copy this script into /var/www/newznab


you must modify line 20 with the appropriate newznab_screen_backfill.sh script for your configuration
(in step 3 I created a copy of newznab_screen.sh & renamed it to newznab_screen_backfill.sh)

Step 5:

run your new startup script:

./NN_Autostart

and watch the magic happen!

If you want to end the session (maybe to run an update etc..) ctrl+c to exit a screen then "tmux kill-server"

PS. If not using Sphinx (why not!) then just edit it out of the script above....same with any information windows you do not require)

No comments:

Post a Comment