These forums are archived

See this post for further info

get_iplayer forums

Forum archived. Posting disabled.

get_iplayer and web pvr running at startup/boot (VM in VirtualBox)

user-508

Does anyone know if there is there a way to have the web pvr to run in the background on startup under linux (ubuntu)?

I have built the vm (ubuntu 14.04) with get_iplayer installed and working successfully (but only after logging in and starting it via ssh). Now I just need to get it to run at startup for when the host machine is rebooted.

I currently run the web pvr manually on my HTPC, and sometimes forget to do this within the current 7 day window. What I'd like to do is have both running on the vm on a permanent basis, then access the web pvr from any pc in my house. This also has the benefit of keeping an insecure web server locked out from the rest of my network.

user-2

Launching the web pvr at startup won't do what you want. In fact, it won't do anything except sit there and wait for you to connect with a browser. As far as PVR functionality is concerned, the web pvr is nothing but a dumb shell that enables you to invoke the actual get_iplayer commands without getting calluses on your typing fingers.

What you need to do is use the cron daemon to automatically launch get_iplayer to run its PVR list at some specified interval. See usage & examples doc in wiki for the basics. If you don't know about cron or how to edit a crontab file, Google is your friend.

user-508

Hi user-2, thank you for responding.
(btw, love your work on keeping get_iplayer up to date. It is very much appreciated.)

Quote:In fact, it won’t do anything except sit there and wait for you to connect with a browser.
Well, that's kind of the point. I want the web pvr available on the VM anytime and from any machine on my network. Right now the web pvr has to be running on the HTPC (windows 7) to be available, which leaves a CMD window open. And if my 3 year old sees it, he'll probably shut it down so he can watch his cartoons... The HTPC is in the family room and is used for all manner of things, not just TV and movies.

I'm aware of running the commands via cron (and task manager for windows) to do various things, and I'll even set these up once I have web pvr running on start up, but I don't want to have to teach my wife how to set up new items for download via the CLI (especially over putty!). Simple is easy, and the web pvr is easy. Hence the VM and an always on web pvr instance.
:)

If this is not possible, then I'll just have to be a bit more diligent with remembering to set new programs to download for my wife.

user-2

I think you're confusing the two parts of the web pvr system: server and client. You could launch the server at system startup, but as I said, it will do absolutely nothing. No pvr list processing, no nothing. You have to instruct it what to do via browser. I think you are also conflating the two sides of PVR system: job creation and job execution. The web pvr browser client does not run your pvr list directly. It merely requests the web pvr server to run get_iplayer to do the job.

You can't launch the browser client at system startup because it will have no display to use. If you have autologin enabled, you could come up with a way to autostart your browser (and the web pvr server) via your window manager's startup configuration. But since the browser-based pvr list invocation is Javascript-driven, you'll have to get a browser driver (e.g., from a testing framework) and set it to also automatically fire up and make the browser do the necessaries to run the pvr list. I shudder to think of the staggering amounts of time you'll be wasting. The web pvr - client and server - is not for automation at the system level, and never has been. OTOH, get_iplayer itself works just fine via automation.

Just because your pvr list is processed under the aegis of cron, that is completely unrelated to how the pvr jobs are created. The jobs are just text files stored in a single location. You can type them in manually if you like. You can use the CLI, your wife can fire up the web pvr and do it via browser, and nothing your kid does will have any effect. Also, it doesn't matter how you run your pvr list. If you want to do some downloads ahead of cron, you can use the CLI, your wife can fire up the web pvr, etc. Do yourself a favour and let cron take care of the automation.

user-30

I'm understanding this as you want to launch get_iplayer CLI at start up on the VM. You also want to start the Webpvr manager as some kind of server type thing on the VM that you can then connect to from another PC on the newtork.

This so that your wife can use the Webpvr from any computer (probably the HTPC) by somehow connecting to the Webpvr server on the VM and add her programmes/manually run her PVR job in the Graphical interface?

You are happy using the CLI over SSH and that's easy so that parts sorted.

There are a few things to confirm:

1) The Webpvr has this server function and can be connected to from any other PC
2) It can be launched from the command line at startup

The second one might be achieved through the instructions below:

http://stackoverflow.com/questions/10495...ommandline

...and...

https://help.ubuntu.com/community/Adding...ionStartup

As for number 1, I'm not sure if that function is possible.

DP, perhaps it is?

user-2

Yes, either as standalone server or via Apache CGI, though not recommended. But OP says he wants to keep web pvr server locked out from rest of network, so have all of web pvr running (and automatically launched) in VM guest. Presumably he plans to access via remote desktop to VM host, which is the simplest option. A browser left running on HTPC wouldn't be particularly kid-proof.

user-508

I don't believe I'm confusing anything.

Quote:You could launch the server at system startup, but as I said, it will do absolutely nothing.
Again, that is fine. Until a browser points at it, I don't expect it to do anything except wait. Just like a good little web server does.

cron is going to handle automation for running downloads. The web pvr is for an easy approach to setting which programs to download.

In a linux installation, via terminal, you run the get_iplayer_web_pvr command. This starts the web server, after which you can access the web pvr manager via the local browser at http://localhost:1935

Once this has started in my VM, instead of accessing it via the local host (no gui in this instance, as headless), I have set the web server to listen on 0.0.0.0:1935, which allows me to access the web pvr manager from any machine on my local network. This is tested and works.

It is this that I want to be available. I want get_iplayer_web_pvr (or whatever needs to run) to start at boot so there is no need to ssh in and restart it manually, just like a normal web server such as apache.

user-30

If you are all tested and working and just need the start up bit to be sorted then a quick bit of googling pointed me towards update-rc.d being your best bet.

I found this cheat sheet that gives an idea of what you need to do or ig into further to start the service you need on boot up and not just on login:

http://www.jamescoyle.net/cheat-sheets/7...heat-sheet

...with some extra detail here...

http://www.jamescoyle.net/how-to/706-add...hat-centos

Have a read and see if that points you in the right direction.

user-2

Given what you say you're actually trying to do, SP has given you the info to get started. There is plenty of information out there on how to write system service scripts. The only aspect germane to get_iplayer is to make sure the user account used to launch the web pvr server, which will in turn launch get_iplayer, has a proper home directory, under which settings, pvr jobs, etc. are stored. There are other permutations, but that is by far the simplest way. You probably want to disable login for that user as well. You're opening one potential security hole with the web pvr server, so no point in opening another one. Again there are other permutations, but disabling login is the simplest place to start.

user-2

Alternatively - as I said in reply to SP, you can configure the web pvr server to run under Apache, which relieves you of the need to manage the service yourself. See the web pvr help for the link its README file, which has the instructions.

user-508

I think I need to spend a bit more time exploring both options: update-rc.d and web pvr under apache.
The second sounds like it will do exactly what I need.

Tonight I spent time looking at the apache option, but apache2 (latest version under ubuntu) runs a bit differently to old apache (apache2.conf instead of httpd.conf, and module loading via symlink or something to that effect), and I haven't been successful in getting the cgi to run. It outputs the source code to the browser window instead of running it on the server end. I need to look at it further and document exactly what I'm doing so I can either back it out or re-apply on a fresh vm image.

To be honest, I started looking at the apache option on the weekend, but couldn't see anywhere that it explicity stated that this would run the web pvr manager page like the standalone web server. The example URLs in the text make it look like a URL based version of the CLI. those instructions probably haven't been update since 2010.

Thank you both for you time. Hopefully I can get this worked out with your pointers above. Googling is all well and good, but if you aren't using the right search terms, you won't find anything. Even if you do get the right answer, sometimes it's all greek if you don't have the right background knowledge...
:)

user-2

Yeah, Ubuntu has drifted a bit from those instructions. I'll make some new instructions for Ubuntu and bump this thread when they're ready.

user-508

That would be great, especially for those that follow. Think I'm going to drop ubuntu as the vm os and run a centos one instead. I'm more familiar with that distro, and it comes with an apache install I understand (at least the last time I installed centos it did).
:)

I might also have a play around on a xampp instance on my work PC (windows) to see if I can get web pvr running under apache on that. Once I have that working, I can use the knowledge to get it working on the vm.

user-2

I don't think I'll bother, then. CGI deployment is a pretty esoteric corner of get_iplayer into which virtually no one ever ventures. The original instructions were taken from CentOS/RHEL, so will work for you. Just ignore everything in that README file except the CGI configuration section. All the bits about streaming URLs and playlists are irrelevant if you're using the browser client,. And read the get_iplayer CentOS installation instructions to make sure you get all the dependencies set up.

These forums are archived

See this post for further info