Create A Python Service on Debian 9

If you have a Python script that you need to run automatically, one great solution is to create a systemd service. This way lets you manage your script using the service command just like any other daemon. Creating your own service on Debian 9 only requires creating one .service file and registering it with systemd. Easy!

System service files are located in /lib/systemd/system/. You can also create user services and those are stored in /usr/lib/systemd/system/. These files specify all the details that systemd needs to start and control the services. There are a lot of options that can be included, however, in its most basic form we only need a few basic things. The example below shows the minimum requirements. Let’s say we put this in a new file at /lib/systemd/system/python-example.service

Description=My Python Example Service

ExecStart=/usr/bin/python /home/me/


To enable the service with systemd, simply tell systemd to enable it as shown below.

# Enable the new service we just created
systemctl enable python-example.service

# Manually start and check its status
service python-example start
service python-example status

That’s all you need to run a Python script as a service! At some point I may throw together an example script and add it to this article, but for now this should get you going.

Further Reading

BSOD After Windows Update KB4056897

Last Thursday, January 4th, 2018, was bad day for Windows 7 users with older AMD processors. Anyone who installs updates automatically most likely woke up on Friday to a BSOD (Blue Screen Of Death) with the words “stop: 0x000000c4 …”

The Problem

We had a handful of computers at the office that wouldn’t boot no matter which way we tried. Not Start Windows Normally, Last Known Good Configuration, Safe Mode, or Startup Repair would work. I spent the entire day on Friday just trying to get those computers back up and running. By the end of it all, I figured out the problem, the cause, and a solution. I also posted my first ever Reddit post about the whole ordeal on /r/sysadmin.

The Cause

As we know now, the culprit was the Quality Update for Windows 7 (KB4056897). It also looks like a few other updates may cause some issues with AMD devices, but big problem is with KB4056897. We have not witnessed any problems from the other updates.

The Solution

Taken from my Reddit post:

“Finally found a solution to remove the update package using DISM. On startup, press F8 and select Repair Your Computer. From there, open a command prompt window. Check that the Windows drive is mapped by running

dir d:

Run the command

dism /image:d:\ /remove-package /packagename:Package_for_RollupFix~31bf3856ad364e35~amd64~~7601.24002.1.4 /norestart

It should say processing 1 of 1 and show a progress bar. If all goes well, it will say completed successfully and you can restart into Windows. We’re going through checking for updates and hiding that patch so it won’t reinstall…”

Microsoft Recall

Microsoft knows of the problems AMD users are having. This morning Microsoft blocked the update for devices with the affected AMD hardware. There is a thread on the Microsoft forum that includes a list of the affected processors. Hopefully, this update recall will prevent more computers from getting the BSOD, but anyone who already installed the update will need to manually remove it from the startup repair command prompt.

Computers and Tech

Computers… ah, yes! They’re such a revolutionary invention. One of the greatest things about them is that they can be programmed to do almost anything. My wide array of experience spans from low-level circuitry and basic microprocessor programming through high-level software development and network management.  Here you’ll find many of the problems that I have run into as well as any tips or tricks I come across.