Turning a python script into a service

So now that I have my build lights I want the python script that controls the lights to be setup to run as soon as the RPi is turned on. So I needed to find a way to setup the python script as a service. I found a REALLY good blog post by Stephen Phillips on how to do this pretty easily.

It worked great! I only noticed one issue that I still need to investigate. If I stop the service the GPIO channels are not closed properly, so the lights will stay on.

Here are some things I’d like to do next:

  • I need to incorporate the code for the TeamCity Provider, so it will query a TeamCity build server (instead of the current test code).
  • Since, I don’t have a TeamCity build server currently I’ll need to make a synthetic or stub service that provides sample output from a TeamCity Build box.
  • Then I would like to build out other providers beyond TeamCity, so it could work with CC.NET or VSTS continuous build servers.
  • Once I create those, create a Python Service Locator, so based on configuration it will choose the correct provider.

Leave a Reply

Your email address will not be published. Required fields are marked *