diff --git a/README.md b/README.md index 2fed8fe..8e7457d 100644 --- a/README.md +++ b/README.md @@ -24,6 +24,12 @@ BASE_URL=http://localhost:3000 docker run -i -v $PWD/static:/opt/static headles BASE_URL=http://localhost:3000 node . ``` +To set up a systemd daemon that starts with the server, use: + +``` +npm run install-daemon +``` + ## Testing the API with httpie: diff --git a/package.json b/package.json index ca6e604..f80be10 100644 --- a/package.json +++ b/package.json @@ -4,7 +4,7 @@ "description": "## Dependencies", "main": "index.js", "scripts": { - "test": "echo \"Error: no test specified\" && exit 1" + "install-daemon": "cp screenshot-service.service /etc/systemd/system/ && systemctl start screenshot-service && systemctl enable screenshot-service" }, "repository": { "type": "git", diff --git a/screenshot-service.service b/screenshot-service.service new file mode 100644 index 0000000..1d61f52 --- /dev/null +++ b/screenshot-service.service @@ -0,0 +1,15 @@ +[Unit] +Description=Service that takes screenshots for users of the Rentgen addon +After=network.target + +[Service] +Type=simple +User=root +Group=root +WorkingDirectory=/root/ss +ExecStart=node /root/ss +Restart=on-failure +RestartSec=1s + +[Install] +WantedBy=multi-user.target