Articles by DrWhoZee

  1. starting get-iplayer web via systemd

    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:

    1. start get-iplayer-web and
    2. have it re-started should it try and weasel out
    3. be able to configure ports and user & group to run as via /etc/default/get_iplayer_web
    4. 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à :-)

  2. encrypted backup

    my new root server host offers—as part of the base package—a 100 GB backup package. access to that space is via SMBFS/CIFS, WebDAV, or FTP. as we don’t really want to have our data lying around in the clear, i needed a solution to encrypt the …

  3. pump the PDF sidebar

    firefox’s PDF viewer is quite nice—particularly so if you consider that it’s all written in JavaScript. one thing that’s been bothering me was the size of the sidebar.

    in my day job i tend to both read and write a number of architecture and specification documents …

  4. one name to catch them all

    today we were trying to do a multipart/form-data POST to one of our webservices using the usually rather usable python requests. the spec of the webservice required that multiple files were to be POSTed as multiparts with the name files and individual filename attributes — a task that python request …

  5. spamassassin: learning from inbox and junk folders

    while tweaking the spam filters on our mail server i finally took the step of adding a cron job to learn from the inbox and junk folders of each user. as we are using spamassassin as part of our spam defense this basically involves a couple of invocations of sa-learn …

  6. ajax fun with jquery & python

    the other day i tried to come up with a minimalistic Ajax setup — minimalistic in the sense of minimal coding overhead. my ingredients of choice were jquery and JavaScript on the client side and python on the server side. the goal was to use both GET and POST REST calls …

  7. emacs tip: getting lines numbered

    the other day i was coding a scala apply(array: Array[String}) method to instantiate an object from a CSV file. i ended up with something like this:

    apply(uuid = uuid,
    source = source,
    hostname = rewired(0),
    type = rewired(0),
    state = rewired(0),
    category = rewired(0),
    id = rewired(0),
    lifecycle = rewired …
  8. sbt10, webplugin, jetty, run-in-place: once more...

    it turns out that the sbt/web-plugin configuration i described in my last post is not quite cutting it. what we observed is that while changes to the contents of the webapp subtree were indeed effective immediately1 sbt commands like prepare-webapp and jetty-reload would sometimes work and sometimes just …

  9. adding a USB monitor

    i’ve long been using an external 22” monitor with my ubuntu linux powered X200 thinkpad. while ubuntu maverick (10.10) has some issues with attaching and detaching the second monitor and subsequent suspend–resume cycles (the second suspend after a detach would not resume, d’oh), ubuntu lucid (10 …

  10. CSS selector transforms...

    we have been using scala and the lift framework for our project for over a year now. as we are starting on a new subcomponent of it, i thought i’d take a crack at using lift’s new CSS selector transforms.

    CSS transforms provide an alternative to the traditional …

  11. fixing failing suspend on maverick system

    i recently got my first real desktop system — as in: not a thinkpad. it’s an 8 core, 8GB, 1 terabyte system with an nvidia graphics chipset allowing two large displays to be powered: really sweet. installing ubuntu maverick 10.10 from the alternate install CD1 was simple and …

  12. using maven to generate your project's scala classpath

    one thing i quite like about scala is that ability to run it in “interpreted” mode via the scala command. that allows me — similiar to python or ipython — to experiment and quickly try things out or even test my classes and objects.

    what was a bit of a pain was …

  13. deploy a maven package locally

    note to self: maven differentiates between installing and deploying a package (which might have been built via a mvn package):

    • install — just installs the JAR file and the POM file, if the -DcreateChecksum=true flag is provided it will create the SHA1 for the JAR only
    • deploy — install JAR and …
  14. OpenSim Zurich Lunch (r6)

    for over a year we’ve been meeting more or less once a month or two over lunch to discuss and chat about all things OpenSim — very creatively volker gässler and i called them OpenSim Zurich Lunches back then when. for the past year we’ve been having lunch at …

[1..5]