Creating Linux services with systemd (Centos / RHEL)

Reference

https://medium.com/@benmorel/creating-a-linux-service-with-systemd-611b5c8b91d6

https://unix.stackexchange.com/questions/463917/systemds-startlimitintervalsec-and-startlimitburst-never-work

https://unix.stackexchange.com/questions/549662/how-to-log-result-if-shell-command-from-systemd-service

For user defined services, location of .service config file in /etc/systemd/system

Sample configuration of a service

[Unit]
Description=ROT13 demo service
After=network.target

[Service]
Type=simple
Restart=always
RestartSec=1
StartLimitInterval=0
StartLimitBurst=5
User=centos
ExecStart=/usr/bin/env php /path/to/server.php

[Install]
WantedBy=multi-user.target

To run command with output to logfile

ExecStart=/bin/sh -c '/usr/bin/php /path/to/application.php >> /var/log/somelogfile.log 2>&1'