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

From Notes_Wiki

Home > CentOS > CentOS 8.x > System Administration > systemd or systemctl > CentOS 8.x Create systemd service for erlang yaws web server

Home > Erlang > Yaws > 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



Home > CentOS > CentOS 8.x > System Administration > systemd or systemctl > CentOS 8.x Create systemd service for erlang yaws web server

Home > Erlang > Yaws > CentOS 8.x Create systemd service for erlang yaws web server