Systemd & ServicesIntermediate
1Question 1 of 1
iniHow does systemd manage background services in Linux?
Explanation & Concept
`systemd` is the standard init system and service manager for Linux. Services are defined in `.service` unit files, specifying restart behavior, dependencies, user privileges, and environment variables.
Code Example
ini
[Unit]
Description=Learna Node.js Web Application
After=network.target postgresql.service
[Service]
Type=simple
User=deploy
WorkingDirectory=/var/www/app
ExecStart=/usr/bin/node dist/server.js
Restart=always
RestartSec=5
Environment=NODE_ENV=production PORT=3000
[Install]
WantedBy=multi-user.targetHow It Works & Key Takeaways
Configuring `Restart=always` ensures that if the application crashes due to an out-of-memory error, `systemd` revives it within 5 seconds.
Mock Test · 1 Questions · Optional
Ready for Networking Commands?
Take a quick test to evaluate yourself, or move straight to the next module.
Intermediate3 questions