summarylogtreecommitdiffstats
path: root/usbip-bind@.service
diff options
context:
space:
mode:
Diffstat (limited to 'usbip-bind@.service')
-rw-r--r--usbip-bind@.service17
1 files changed, 17 insertions, 0 deletions
diff --git a/usbip-bind@.service b/usbip-bind@.service
new file mode 100644
index 000000000000..d4f19140ece2
--- /dev/null
+++ b/usbip-bind@.service
@@ -0,0 +1,17 @@
+# /etc/systemd/system/usbip-bind@.service
+[Unit]
+Description=USB-IP Binding on bus id %I
+After=network-online.target usbipd.service
+Wants=network-online.target
+Requires=usbipd.service
+
+[Service]
+Type=simple
+EnvironmentFile=/etc/usbip/bind-devices/%i.conf
+ExecStart=/bin/sh -c "/usr/bin/usbip bind -b $(/usr/bin/usbip list -p -l | grep '#usbid=$USBIP_DEVICE#' | cut '-d#' -f1)"
+RemainAfterExit=yes
+ExecStop=/bin/sh -c "/usr/bin/usbip unbind -b $(/usr/bin/usbip list -p -l | grep '#usbid=$USBIP_DEVICE#' | cut '-d#' -f1)"
+Restart=on-failure
+
+[Install]
+WantedBy=multi-user.target