Better examples

Signed-off-by: fbt <fbt@fleshless.org>
This commit is contained in:
2026-11-27 16:14:30 +00:00
parent fd658f7545
commit f74df5962e
11 changed files with 152 additions and 25 deletions
+18 -5
View File
@@ -1,10 +1,23 @@
#!/usr/bin/env ssm
service_respawn = always
service_command = /usr/bin/sshd -D -f "/etc/ssh/sshd_config"
# OpenSSH server.
#
# sshd is run in foreground (-D) so ssm can track the process directly.
# Host keys are created if they're missing; sshd refuses to start
# without them, so do it before service_command is spawned.
service_respawn = on-failure
service_command = /usr/sbin/sshd -D -f /etc/ssh/sshd_config
service_ready_timeout = 10
pre_start() {
if ! [[ -e "/etc/ssh/ssh_host_key" ]]; then
ssh-keygen -A
fi
if [[ ! -f /etc/ssh/ssh_host_rsa_key ]]; then
ssh-keygen -A
fi
}
# Wait for sshd to answer on port 22, not just for the parent process
# to return.
ready() {
(exec 3<>/dev/tcp/127.0.0.1/22) 2>/dev/null
}