Newznab Updates as a Service (Ubuntu)Warning: Use of undefined constant template_directory - assumed 'template_directory' (this will throw an Error in a future version of PHP) in /homepages/10/d87402808/htdocs/backporchbeer/wp-content/themes/andyblue/single.php on line 11

Disclaimer: I am just a hobbyist, so don’t be surprised if I am unable to answer any questions you have. That said, feel free to ask and I’ll do my best. I am on Stack Overflow, so I would encourage you to ask questions there then leave a link here. That way others could benefit from your questions.

I was using the update script /var/www/newznab/misc/update_scripts/nix_scripts/newznab_screen.sh in a screen session, as recommended by newznab install/configuration sites. it froze all the time and required a lot of management to keep it running, including having to rerun it after every reboot. So, I have been working on creating a solution that runs as a service which allows it to run after reboot, and restarting it from the command line is simpler.

Another goal was to create a process that could be monitored, and could generate an email alert if the script hung. I completed the monitoring and email alerts using Nagios 4.1.1, but I am still working on an automated restart (which should be possible with Nagios.)

My first step was creating a file the script could touch before every cycle. There are probably files that could serve this purpose within the standard newznab configuration, but I struggled to find one that was easy to identify. I created this:

user@server:/$ touch /var/www/newznab/misc/monitor.txt
user@server:/$ vi /var/www/newznab/misc/monitor.txt > This file will be “touch"ed to show updates are happening.
user@server:/$