#!/bin/bash

usermod -a -G uucp user1

sleep 1

echo -e "\
[Unit]\r\
Description=fmdx-webserver\r\
After=network.target sound.target\r\
\r\
[Service]\r\
Type=simple\r\
WorkingDirectory=/home/user1/fm-dx-webserver\r\
ExecStartPre=/usr/bin/sleep 1\r\
ExecStart=/usr/bin/node .\r\
User=user1\r\
Restart=always\r\
RestartSec=1\r\
IgnoreSIGPIPE=no\r\
SendSIGHUP=yes\r\
StandardOutput=null\r\
StandardError=null\r\
\r\
[Install]\r\
WantedBy=default.target\r" > /lib/systemd/system/fm.service

sleep 1

systemctl enable fm
