Check out example codes for "restart postgresql.service Failed to restart postgresql.service: Unit not found.". It will help you in understanding the concepts better.

Code Example 1

systemctl list-units|grep postgresql
service postgresql-12.service restart

Learn ReactJs, React Native from akashmittal.com