Browse Source

add basic systemd service unit example

put to /etc/systemd/system/librespot.service and then do `systemctl daemon-reload`
herrernst 8 năm trước cách đây
mục cha
commit
b9eb4de090
2 tập tin đã thay đổi với 16 bổ sung1 xóa
  1. 2 1
      Cargo.toml
  2. 14 0
      assets/librespot.service

+ 2 - 1
Cargo.toml

@@ -92,5 +92,6 @@ available in the official library."""
 section = "sound"
 priority = "optional"
 assets = [
-    ["target/release/librespot", "usr/bin/", "755"]
+    ["target/release/librespot", "usr/bin/", "755"],
+    ["assets/librespot.service", "lib/systemd/system/", "644"]
 ]

+ 14 - 0
assets/librespot.service

@@ -0,0 +1,14 @@
+[Unit]
+Description=Librespot
+Requires=network-online.target
+After=network-online.target
+
+[Service]
+#User=librespot
+Restart=always
+RestartSec=10
+ExecStart=/usr/bin/librespot -n "%p on %H"
+
+[Install]
+WantedBy=multi-user.target
+