Linux for Developers
/Advanced
Systemd Units
Definition
The plain-text configuration files (usually ending in `.service`, `.target`, or `.timer`) that teach systemd exactly how to manage, start, and stop a specific application.
Explain Like I'm New
The instruction manual for your custom app. If you write a Python app, Linux doesn't know how to run it as a background service until you write a Unit File telling Linux exactly which command to run.
Real World Example
A developer writes a custom Node.js bot. They create a file `/etc/systemd/system/bot.service` containing `ExecStart=/usr/bin/node /opt/bot/app.js`. Now, they can magically use `systemctl start bot` just like any professional software.
Common Use Cases
- •Deploying custom code as a service
- •Automatic restart on crash
Interview Questions
basic
- What mandatory command must you run after editing or creating a new systemd unit file?
intermediate
- What does the `Restart=always` line do inside a `.service` file?