being a great fan of a number of BBC programmes (doctor who, sherlock, the choir, diy sos, …) i’ve been using get-iplayer for quite a while. one of my raspberry pi boxes is tasked with
- running tvheadend for all the digital satellite stuff and with
- running get-iplayer for the BBC programmes we’d like to timeshift
among other things (physically and virtually re-wiring our house network) i ended up moving tvheadend and get-iplayer to newly installed raspberry pi 2 running debian jessie. only after trying to get the init script for get-iplayer-web to run—and failing—did i realize that debian jessie is using systemd and for some reason the sys-v systemd converter didn’t like the init script i was trying to feed it.
d’oh.
well, perhaps not “d’oh”. i’ve never really liked the sys-v init script system: too much fuffing around with start/stop daemon incantations when all you want is just to start a simple app. so, time for some learning by doing.
basically i want:
- start
get-iplayer-web
and - have it re-started should it try and weasel out
- be able to configure ports and user & group to run as via
/etc/default/get_iplayer_web
- re-direct all stdout & stderr to syslog.
alexander patrakov’s blog entry “writing systemd service files”, the systemd.service, and the systemd.exec man pages proved to be rather helpful.
first, i created /etc/systemd/system/get-iplayer-web.service
:
[gist:id=42339acffe569ce30446]
next, /etc/default/get_iplayer_web
:
[gist:id=456bd3ae228db5386ec5]
then, i enabled the service…
# systemctl enable get-iplayer-web.service
…and started it:
# systemctl status get-iplayer-web.service
get-iplayer-web.service - get iplayer web service
Loaded: loaded (/etc/systemd/system/get-iplayer-web.service; enabled)
Active: active (running) since Sat 2016-01-02 13:15:53 UTC; 1h 2min ago
Main PID: 1814 (perl)
CGroup: /system.slice/get-iplayer-web.service
└─1814 /usr/bin/perl /usr/share/get_iplayer/get_iplayer.cgi -p 1935 -g /usr/bin/get_iplayer -l 0.0.0.0
Jan 02 13:20:55 pvr-sat get_iplayer_web[1814]: CGI::param called in list context from package main line 4065, this can lead to vulnerabilities. See the warning in "Fet...7> line 11.
Jan 02 13:20:55 pvr-sat get_iplayer_web[1814]: CGI::param called in list context from package main line 4065, this can lead to vulnerabilities. See the warning in "Fet...7> line 11.
Jan 02 13:20:55 pvr-sat get_iplayer_web[1814]: DEBUG: get_iplayer options: "modes=default" "refreshfuture=0" "fields=name" "force=0" "skipdeleted=0" "future=0" "thumb=0" "subtitl...
Jan 02 13:20:55 pvr-sat get_iplayer_web[1814]: INFO: Command: /usr/bin/get_iplayer --encoding-locale=UTF-8 --encoding-console-out=UTF-8 --nocopyright --expiry=99999999...efault?hide
Jan 02 13:20:58 pvr-sat get_iplayer_web[1814]: POST: /
Jan 02 13:20:58 pvr-sat get_iplayer_web[1814]: QUERY_STRING = AUTOPVRRUN=4&NEXTPAGE=search_progs
Jan 02 13:20:58 pvr-sat get_iplayer_web[1814]: CGI::param called in list context from package main line 4065, this can lead to vulnerabilities. See the warning in "Fet...8> line 11.
Jan 02 13:20:58 pvr-sat get_iplayer_web[1814]: CGI::param called in list context from package main line 4065, this can lead to vulnerabilities. See the warning in "Fet...8> line 11.
Jan 02 13:20:58 pvr-sat get_iplayer_web[1814]: DEBUG: get_iplayer options: "skipdeleted=0" "future=0" "thumb=0" "modes=default" "refreshfuture=0" "fields=name" "force=0" "subtitl...
Jan 02 13:20:58 pvr-sat get_iplayer_web[1814]: INFO: Command: /usr/bin/get_iplayer --encoding-locale=UTF-8 --encoding-console-out=UTF-8 --nocopyright --expiry=99999999...fault?hide%
Hint: Some lines were ellipsized, use -l to show in full.
et voilà :-)