IrosTheBeggar / mStream

The easiest music streaming server available
http://mstream.io
GNU General Public License v3.0
2.22k stars 188 forks source link

Start mStream with systemd #325

Open aroundmyroom opened 3 years ago

aroundmyroom commented 3 years ago

Just a howto how I use finally mStream with auto-start rather than everytime using mStream in a screen session ;)

First we create a systemd service file

sudo nano -w /lib/systemd/system/music.service (you can name the file you want)

You see in the service section an environment part, I do not think it is needed, but it does not give an issue at my side.

[Unit] Description=Music Mstream Server Documentation=Music After=network.target

[Service] Environment=NODE_PORT=3000 Type=simple User=[user what needs to run mStream] ExecStart=/usr/bin/node /home/mStream/cli-boot-wrapper.js Restart=on-failure

[Install] WantedBy=multi-user.target

Do save this than to test

sudo systemctl daemon-reload sudo systemctl start music.service sudo systemctl status music.service to see if there is no issue

enabling for start sudo systemctl enable music.service

if rebooted your mStream server will now start automatically ;)

IrosTheBeggar commented 3 years ago

Nice writeup. Ive been using PM2 to handle autoboot for mStream, but this is a good alternative. Ill add it to the docs

aroundmyroom commented 3 years ago

Yeah I saw that on discord, but when I looked into PM2 I thought that I needed more time to config that than the systemd part ;) so a little contribution from my part ;)