Use `chpst` instead of `su` to start galera-healthcheck
-#!/bin/bash -e
+#!/usr/bin/env bash
+
+set -eo pipefail
job_dir=/var/vcap/jobs/mysql
run_dir=/var/vcap/sys/run/galera-healthcheck
@@ -24,11 +26,11 @@ case $1 in
ulimit -n <%= p('cf_mysql.mysql.max_open_files') %> # HIGH Ulimit for SST of lots of tables (in case we run the bootstrap errand)
- su - vcap -c -o pipefail \
- "$package_dir/bin/galera-healthcheck \
+ chpst -u vcap:vcap bash -c "
+ $package_dir/bin/galera-healthcheck \
-configPath=$job_dir/config/galera_healthcheck_config.yaml \
>>$log_dir/galera-healthcheck.stdout.log \
- 2>>$log_dir/galera-healthcheck.stderr.log &"
+ 2>>$log_dir/galera-healthcheck.stderr.log" &
log "Starting galera-healthcheck... done"
;;
