diff mbox series

[4/4] package/openssh: check running instance on "start"

Message ID 20240612183136.2145705-5-fiona.klute@gmx.de
State New
Headers show
Series Refactor OpenSSH init.d script | expand

Commit Message

Fiona Klute June 12, 2024, 6:31 p.m. UTC
If there already is a running instance a new sshd fails to start,
leaving the old one in place. The init script silently ignored
that. Show an error message and return a non-zero exit code instead.

Signed-off-by: Fiona Klute <fiona.klute+wiwa@gmx.de>
---
 package/openssh/S50sshd | 4 ++++
 1 file changed, 4 insertions(+)

--
2.45.1
diff mbox series

Patch

diff --git a/package/openssh/S50sshd b/package/openssh/S50sshd
index 87430bbec8..59589bc863 100644
--- a/package/openssh/S50sshd
+++ b/package/openssh/S50sshd
@@ -15,6 +15,10 @@  start() {
 	/usr/bin/ssh-keygen -A

 	printf "Starting sshd: "
+	if [ -f "${PIDFILE}" ]; then
+		echo "ERROR: already running"
+		return 1
+	fi
 	/usr/sbin/sshd
 	echo "OK"
 }