Create a custom systemd service

From DevOps Notebook
Revision as of 06:35, 14 May 2020 by MilosZ (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
# vim /etc/systemd/system/myservice.service

Created script content

[Unit]
Description=My systemd service.

[Service]
Type=simple
ExecStart=/bin/bash /usr/bin/my_service.sh

[Install]
WantedBy=multi-user.target

Reload systemd and start script

# systemctl daemon-reload
# systemctl start myservice.service
# systemctl enable myservice.service # start on boot