Files
ssm/examples/services/sshd
T
fbt f74df5962e Better examples
Signed-off-by: fbt <fbt@fleshless.org>
2026-11-27 16:14:30 +00:00

24 lines
595 B
Plaintext
Executable File

#!/usr/bin/env ssm
# 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 [[ ! -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
}