Software
Run Homebridge as a Service at Boot
A template init script that starts, stops and restarts a Homebridge server as a service on a Linux computer such as a Raspberry Pi.
- Raspberry Pi
- Homebridge
- Archived
- 2 min read
Archived project
The GitHub repository for this project is archived: it is read-only and no longer updated. What follows describes the project as it was, so check for a newer alternative before you build it.
A Homebridge server has to start by itself when the computer boots, and restart when it stops. This project is a template for a service script that does that on a Linux computer such as a Raspberry Pi.
Homebridge is a program that runs on a computer such as a Raspberry Pi, and makes devices that do not support HomeKit show up in the Apple Home app. This project dates from the Homebridge years, before the native HomeKit firmware of this site. For how the site builds HomeKit devices today, see HomeKit or Matter for your ESP32.
What the script does
The template is a standard init script with four commands:
| Command | What it does |
|---|---|
| start | Starts the program, unless it is running, and stores its process number in a PID file |
| stop | Stops the program, waiting up to ten seconds for it to end |
| restart | Stops and starts it |
| status | Says whether the program is running |
The output of the program goes to log files: /var/log/<name>.log for the normal output and /var/log/<name>.err for errors. The PID file is /var/run/<name>.pid. The name is the name of the script file.
Fill it in
Three variables at the top of the file are empty. Fill them in for Homebridge:
| Variable | Meaning | Example |
|---|---|---|
dir | The folder the program starts in | /home/pi |
cmd | The command that starts the program | homebridge |
user | The user that runs it. Leave it empty to run as root | pi |
The values in the last column are examples. Put the file in /etc/init.d/ under the name of the service, make it executable and use it like this:
sudo /etc/init.d/homebridge start
sudo /etc/init.d/homebridge status
Good to know
- The repository holds the template script only.
- The repository is under the MIT licence.
- Apple, HomeKit and Homebridge are trademarks of their owners. This project is not made or approved by them.
The project is in the HomeBridge—Installation repository on GitHub.
More projects
Keep building.
Electronics, 3D printing and CNC builds, documented from the first idea to the last screw.
All projects

