A simple playground repository for learning how to run and manage Linux services using systemd. The goal of this project is not to build a production-ready application, but to understand the fundamentals of:
- Creating a systemd service unit
- Managing services with
systemctl - Viewing logs with
journalctl - Organizing deployment-related files inside a repository
.
├── bin/
│ └── hello-world
├── etc/
│ └── systemd/
│ └── system/
│ └── hello-world.service
├── go.mod
├── main.go
└── readme.md
| Path | Description |
|---|---|
main.go |
Sample Go application |
bin/ |
Compiled binaries |
etc/systemd/system/ |
Systemd unit files managed inside the repository |
readme.md |
Project documentation |
The sample application:
- Starts an HTTP server
- Returns
Hello World - Writes a log message every 5 seconds
This application exists only to provide a process that can be managed by systemd.
Compile the application:
go build -o bin/hello-world .Run it manually:
./bin/hello-worldsudo cp etc/systemd/system/hello-world.service /etc/systemd/system/sudo cp bin/hello-world /usr/local/bin/hello-worldsudo cp /path-to-your-project/.env /etc/default/hello-worldsudo systemctl daemon-reloadsudo systemctl start hello-worldsudo systemctl status hello-worldAfter completing this playground, you should understand:
- What a systemd service is
- How Linux services are started and supervised
- How automatic restart policies work
- How to inspect service logs