examples, oneshot services rework
Signed-off-by: fbt <fbt@fleshless.org>
This commit is contained in:
11
examples/services/iptables
Executable file
11
examples/services/iptables
Executable file
@@ -0,0 +1,11 @@
|
||||
#!/usr/bin/env ssm
|
||||
|
||||
service_oneshot = true
|
||||
service_command = /usr/bin/false
|
||||
|
||||
service::pre_start() {
|
||||
cat <<- EOF
|
||||
Please don't. Use ferm or any other wrapper.
|
||||
You will just reinvent one in here anyway.
|
||||
EOF
|
||||
}
|
8
examples/services/nginx
Executable file
8
examples/services/nginx
Executable file
@@ -0,0 +1,8 @@
|
||||
#!/usr/bin/env ssm
|
||||
|
||||
service_respawn = on-failure
|
||||
service_command = /usr/bin/nginx
|
||||
service_pidfile = /run/nginx.pid
|
||||
|
||||
# Do not reload the service if the config test fails.
|
||||
pre_reload() { "$service_command" -t "$@"; }
|
9
examples/services/rc.local
Executable file
9
examples/services/rc.local
Executable file
@@ -0,0 +1,9 @@
|
||||
#!/usr/bin/env ssm
|
||||
|
||||
service_type = oneshot
|
||||
service_command = /etc/rc.local
|
||||
|
||||
pre_start() {
|
||||
# Do nothing, successfully, if /etc/rc.local is not executable.
|
||||
[[ -x "/etc/rc.local" ]] || die 0
|
||||
}
|
10
examples/services/sshd
Executable file
10
examples/services/sshd
Executable file
@@ -0,0 +1,10 @@
|
||||
#!/usr/bin/env ssm
|
||||
|
||||
service_respawn = always
|
||||
service_command = /usr/bin/sshd -D -f "/etc/ssh/sshd_config"
|
||||
|
||||
pre_start() {
|
||||
if ! [[ -e "/etc/ssh/ssh_host_key" ]]; then
|
||||
ssh-keygen -A
|
||||
fi
|
||||
}
|
7
examples/services/tinc
Executable file
7
examples/services/tinc
Executable file
@@ -0,0 +1,7 @@
|
||||
#!/usr/bin/env ssm
|
||||
|
||||
# This trick was neat back in 2011, I swear
|
||||
var tinc_network = "${service_name##*-}"
|
||||
|
||||
service_respawn = on-failure
|
||||
service_command = /usr/bin/tincd -D -n "$tinc_network"
|
Reference in New Issue
Block a user