[Request] examples of systemd service file with tmux and screen
You said you used screen to detach flood from shell but I tried to write a systemd service (/etc/systemd/system/flood.service) with tmux:
[Unit]
Description=flood web interface for rTorrent
After=network.target
[Service]
Type=forking
KillMode=none
User=myuser
ExecStart=/usr/bin/tmux new-session -s flood -n flood -d npm run start:production
ExecStop=/usr/bin/bash -c "/usr/bin/tmux send-keys -t flood C-q && while pidof gulp > /dev/null; do sleep 0.5; done"
WorkingDirectory=/home/myuser/flood/
Restart=on-failure
[Install]
WantedBy=multi-user.target
But it doesn't work.
It would be great if you can find a way to provide some examples of systemd service file with tmux and screen.
Another approach: https://aur.archlinux.org/cgit/aur.git/tree/flood.service?h=flood-git
- I installed nodejs and npm globally.
- I created a new user flood.
- I installed flood in
/srv/floodand chown it to flood user - I change
/etc/systemd/system/flood.serviceto:
[Unit]
Description=Flood rTorrent Web UI
After=network.target
[Service]
WorkingDirectory=/srv/flood
ExecStart=/usr/bin/npm start --production /srv/flood
User=flood
[Install]
WantedBy=multi-user.tar
It works. But no killing via systemd. And the whole process should be written in the README.
Things like this belong in the wiki rather than README (even my screen recommendation should be in the wiki, if anywhere). I'd love to see your contributions there!
Wiki article done: https://github.com/jfurrow/flood/wiki/Install-flood-with-a-service-account
Thanks @noraj1337!!!