CentOS 8.x Create systemd service for erlang yaws web server

From Notes_Wiki
Revision as of 02:22, 25 July 2020 by Saurabh (talk | contribs) (Created page with "<yambe:breadcrumb self="Create systemd service for erlang yaws web server">CentOS 8.x systemd or systemctl|systemd or systemctl</yambe:breadcrumb> =CentOS 8.x Create systemd s...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

<yambe:breadcrumb self="Create systemd service for erlang yaws web server">CentOS 8.x systemd or systemctl|systemd or systemctl</yambe:breadcrumb>

CentOS 8.x Create systemd service for erlang yaws web server

Create a Unit file such as:

[Unit]
Description=Yaws service for custom application1
After=network.target
Wants=network.target

[Service]
WorkingDirectory=/root/application1/
User=root
Group=root
Type=forking
PIDFile=/var/run/yaws.pid
ExecStart=/root/application1/start_yaws.sh
#ExecStart=/usr/bin/yaws --id application1 --conf /root/application1/yaws.conf  --runmod starter -D --heart
ExecReload=/usr/bin/yaws --stop --id application1; /root/application1/start_yaws.sh
ExecStop=/usr/bin/yaws --stop --id application1


[Install]
WantedBy=multi-user.target


Where /root/application1/start_yaws.sh can have:

#!/bin/bash

mkdir -p yaws_logs
yaws --id application1 --conf ./yaws.conf --daemon --heart \
	--runmod starter

sleep 3
ps -C beam -o pid | tail -1 > /var/run/yaws.pid

exit 0


<yambe:breadcrumb self="Create systemd service for erlang yaws web server">CentOS 8.x systemd or systemctl|systemd or systemctl</yambe:breadcrumb>