--- title: systemctl โ€” Service management date: 2026-10-18 time: 12:00 model: admin category: programs author_type: human summary: A command for starting, stopping, restarting, and checking the status of systemd services. The heart of Linux operations. tags: program, Service and process management, systemctl --- **๐Ÿ’ฌ "systemctl command"** systemctl **controls services (units)**. Starting, stopping, restarting, and enabling at boot are all covered here. For troubleshooting, use status to see both the state and recent logs. - **Concept**: Manages systemd units (services, timers, sockets, etc.). - **status**: Shows active state, last exit code, and recent logs. - **enable/disable**: Sets whether to start automatically at boot. - **daemon-reload**: Always run after modifying unit files. ## Commonly used options | Option | Description | | --- | --- | | start/stop/restart | Start/stop/restart the service | | enable --now | Enable at boot and start immediately | | status | Check status and recent logs | | reload | Reload configuration without interruption (only for services that support it) | ## 3 essential command combinations - `systemctl status myapp --no-pager` โ€” Check service status and recent logs - `systemctl restart myapp && systemctl is-active myapp` โ€” Verify it is running after restart - `systemctl enable --now myapp` โ€” Enable at boot + start immediately **๐Ÿ’ฌ "Please give an example using real production logs."** Here are common situations on a live production server, laid out step by step. ### Step 1 ยท Check status Check the current active state and last error. ``` systemctl status myapp --no-pager ``` ### Step 2 ยท Apply configuration If you modified the unit, reload it and restart. ``` systemctl daemon-reload && systemctl restart myapp ``` ### Step 3 ยท Verify Check the active state and logs. ``` systemctl is-active myapp && journalctl -u myapp -n 20 --no-pager ``` ## In practice, use it like this ### 1. Apply configuration changes **Situation** โ€” You changed an environment variable in the myapp unit. ``` systemctl daemon-reload && systemctl restart myapp ``` **Result** โ€” The service restarts with the new settings. **Point** โ€” If you skip daemon-reload, the old settings remain in effect. ### 2. Service does not start after boot **Situation** โ€” After a reboot, the service is down. ``` systemctl is-enabled myapp && systemctl enable myapp ``` **Result** โ€” If it was disabled, enable registers it to start at boot. **Point** โ€” Use is-enabled first to check whether it starts automatically. ## Things to watch out for - Restart briefly interrupts the service. If you need zero downtime, check whether the service supports reload. - If you stop a service and forget to start it, it remains down. - Always run daemon-reload after manually editing unit files. - Stop production services only after obtaining user approval. ## Actual output This shows the service status and recent logs. ![systemctl command output: service status](https://games.aidebatehub.com/assets/systemctl-demo.png) Live production server --- Source (HTML): https://games.aidebatehub.com/programs/linux/services/systemctl.html This file is an auto-generated Markdown twin of the DevHub document.