Last active
September 22, 2022 18:33
-
-
Save romanvm/8c742c5d3ce4c52889fe0669fedcb358 to your computer and use it in GitHub Desktop.
Example of a simple Linux systemd service
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| [Unit] | |
| Description=Example systemd service | |
| After=network.target | |
| StartLimitIntervalSec=0 | |
| [Service] | |
| Type=simple | |
| Restart=on-sucess | |
| RestartSec=1 | |
| User=nobody | |
| ExecStart=/bin/bash -c "tail -f /dev/null" | |
| [Install] | |
| WantedBy=multi-user.target |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
A
.servicefile needs to be created in/etc/systemd/systemdirectory.ExecStartpath must be absolute.Essential commands:
sudo systemctl enable <service-name>sudo systemctl start <service-name>sudo systemctl stop <service-name>sudo systemctl disable <service-name>