Comment on page


Many Linux distributions (including Ubuntu) use systemd which manages system services.
In the following text an example service named vultrdata is used for illustrative purposes.
A service is defined in a file named like /etc/systemd/system/vultrdata.service. Unit files have a format like in this example:
Description=Vultr Instance Metadata Service
ExecStart=/opt/vultrdata/vultrdata --addr --port 8888 --userdata
After creating the file in the /etc/systemd/system directory, issue this command to register it:
$ sudo systemctl daemon-reload
Then you can check the status:
$ sudo systemctl status vultrdata
● vultrdata.service - Vultr Instance Data Service
Loaded: loaded (/etc/systemd/system/vultrdata.service; disabled; vendor preset: enabled)
Active: active (running) since Sun 2020-04-05 19:35:56 UTC; 1 weeks 0 days ago
Main PID: 19694 (vultrdata)
Tasks: 16 (limit: 4661)
CGroup: /system.slice/vultrdata.service
├─19496 /opt/vultrdata/vultrdata --addr --port 8888 --userdata
└─19509 /opt/vultrdata/vultrdata --addr --port 8888 --userdata
Or start, stop, restart it:
$ sudo systemctl start vultrdata.service
$ sudo systemctl stop vultrdata.service
$ sudo systemctl restart vultrdata.service
You can enable or disable starting the unit/service on system startup:
$ sudo systemctl enable vultrdata
$ sudo systemctl disable vultrdata
You can see/tail all systemd logs, or just for your service (unit):
$ sudo journalctl -f
$ sudo journalctl -f -u vultrdata