Running PVR from Cron
Mike Crowe
mac at mcrowe.com
Mon Nov 25 08:15:41 EST 2013
On Sunday 24 November 2013 at 13:39:06 +0000, Phil White wrote:
> Hi all
>
> I have a gentoo setup here and run the PVR facility every night at 1am.
>
> Sometimes, I am encountering a bug (I believe in rtmpdump, not
> get_iplayer), which means the download never completes.
>
> In an attempt to catch this, I have another script running at 7am to
> kill any get_iplayer and rtmpdump process...
> ... Except that sometimes the darn thing just respawns and carries on as before.
>
> Any advice on how I can handle this? How *should* I be calling the PVR
> function, and killing off the resultant processes?
[snip]
> Technical details:
> Watching what happens, it appears that the process is as follows:
> get_iplayer will start to download a file.
> At some point during the download, there will be an error (sorry, I
> have lost the exact message), and an attempt will occur to renegotiate
> a download. It is here that everything always goes wrong. CPU usage
> goes up to 100%, and the process will continue to download data
> ad-infinitum (which is a bugger, since I am on a restricted download
> tarriff. I then have next-to-no internet for the rest of the month...)
[snip]
I had the same problem when a faulty modem made my connection rather
unreliable. I solved it by limiting get_iplayer and its subprocess to only
ten minutes of CPU time each. This is ample for normal use but ensures that
rtmpdump will spin for up to ten minutes and then be killed off.
I just put this in my download script:
ulimit -t 600
If you persist with trying to kill get_iplayer you might like this patch
that ensured get_iplayer cleans up after itself when it receives more
signals:
--
commit a2f38bedebe4ea412f59f686d2a07ab60bf181f2
Author: Mike Crowe <mac at mcrowe.com>
Date: Tue Aug 6 19:29:10 2013 +0100
Clean up on more signals
diff --git a/get_iplayer b/get_iplayer
index ea6c034..9df2520 100755
--- a/get_iplayer
+++ b/get_iplayer
@@ -497,7 +497,7 @@ for ( progclass() ) {
}
# Setup signal handlers
-$SIG{INT} = $SIG{PIPE} = \&cleanup;
+$SIG{TERM} = $SIG{HUP} = $SIG{ALRM} = $SIG{INT} = $SIG{PIPE} = \&cleanup;
# Other Non option-dependant vars
my $historyfile = "${profile_dir}/download_history";
HTH.
Mike.
More information about the get_iplayer
mailing list