Files
ssm/examples/services/sshd
T

24 lines
595 B
Plaintext
Raw Normal View History

2018-03-09 02:31:14 +03:00
#!/usr/bin/env ssm
2026-11-27 16:14:30 +00:00
# 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
2018-03-09 02:31:14 +03:00
pre_start() {
2026-11-27 16:14:30 +00:00
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
2018-03-09 02:31:14 +03:00
}