Skip to content

Commit 9fb5f00

Browse files
committed
Added the EX_UNAVAILABLE to the daemon when no hardware and the service file now does not restart if there is no hardware
1 parent 6db874f commit 9fb5f00

File tree

3 files changed

+6
-3
lines changed

3 files changed

+6
-3
lines changed

rpm/usbrelay.spec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
Name: usbrelay
2-
Version: 1.1.1
2+
Version: 1.1.2
33
Release: %autorelease
44
Summary: A library and command line tool to control USB-connected relays based on hidapi
55
License: GPL-2.0-or-later

usbrelayd

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,8 @@ count = usbrelay_py.board_count()
8787

8888
if(count < 1):
8989
print("No usbrelay modules connected",flush=True)
90-
exit()
90+
# exit with EX_UNAVAILABLE
91+
exit(69)
9192
else:
9293
print("Modules Connected: ",count,flush=True)
9394

usbrelayd.service

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,9 @@ StartLimitIntervalSec=10
66

77
[Service]
88
Type=simple
9-
Restart=always
9+
# Daemon exits with EX_UNAVAILABLE (69) when there is no compatible hardware plugged in
10+
Restart=on-failure
11+
RestartPreventExitStatus=69
1012
RestartSec=1
1113
DynamicUser=yes
1214
# SupplementaryGroups should match the group used in udev rules

0 commit comments

Comments
 (0)