aboutsummaryrefslogtreecommitdiffstats
path: root/roles/rc/templates/rc_openbsd.j2
diff options
context:
space:
mode:
authorbinary <me@rgoncalves.se>2021-01-22 11:50:28 +0100
committerbinary <me@rgoncalves.se>2021-01-22 11:50:28 +0100
commita162df038f57502b21435034bf1e05e7e976d346 (patch)
tree5600df190987bce84124516475d40b2f082139b5 /roles/rc/templates/rc_openbsd.j2
parent642df4fb6653bd67f398a08412e77fda9b2dfe03 (diff)
downloadinfrastructure-a162df038f57502b21435034bf1e05e7e976d346.tar.gz
Change working directory when required on rc OpenBSd
Diffstat (limited to 'roles/rc/templates/rc_openbsd.j2')
-rw-r--r--roles/rc/templates/rc_openbsd.j215
1 files changed, 14 insertions, 1 deletions
diff --git a/roles/rc/templates/rc_openbsd.j2 b/roles/rc/templates/rc_openbsd.j2
index 30f1c0a..6e60807 100644
--- a/roles/rc/templates/rc_openbsd.j2
+++ b/roles/rc/templates/rc_openbsd.j2
@@ -1,11 +1,24 @@
#!/bin/ksh
-#
# managed by Ansible
daemon="{{ rc_cmd }}"
daemon_flags="{{ rc_args }}"
daemon_user="{{ rc_user }}"
+daemon_dir="{{ rc_dir }}"
+
+rc_bg="{{ "YES" if rc_dir is defined else "NO" }}"
+
+{% if rc_strictpexp is defined and rc_strictpexp %}
+pexp="${daemon} ${daemon_flags}"
+{% endif %}
. /etc/rc.d/rc.subr
+{% if rc_dir is defined %}
+rc_start() {
+ ${rcexec} "cd ${daemon_dir} ; pwd ; ${daemon} ${daemon_flags}"
+}
+{% endif %}
+
+
rc_cmd $1
remember that computers suck.