From 4c1997620b49359100fd5b02c91df004b116cea2 Mon Sep 17 00:00:00 2001 From: tschettervictor <85497460+tschettervictor@users.noreply.github.com> Date: Tue, 22 Jul 2025 21:24:05 -0600 Subject: [PATCH] monitor: use jexec --- usr/local/share/bastille/monitor.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/usr/local/share/bastille/monitor.sh b/usr/local/share/bastille/monitor.sh index fdce9f5c..29776cb5 100644 --- a/usr/local/share/bastille/monitor.sh +++ b/usr/local/share/bastille/monitor.sh @@ -129,11 +129,11 @@ for _jail in ${JAILS}; do if [ -z "${ACTION}" ] && [ -f "${bastille_jail_monitor}" ]; then for _service in $(xargs < "${bastille_jail_monitor}"); do ## check service status - if ! bastille service "${_jail}" "${_service}" status >/dev/null 2>/dev/null; then + if ! jexec -l -u root "${_jail}" service "${_service}" status >/dev/null 2>/dev/null; then echo "$(date '+%Y-%m-%d %H:%M:%S'): ${_service} service not running in ${_jail}. Restarting..." | tee -a "${bastille_monitor_logfile}" ## attempt to restart the service if needed; update logs if unable - if ! bastille service "${_jail}" "${_service}" restart; then + if ! jexec -l -u root "${_jail}" service "${_service}" restart; then echo "$(date '+%Y-%m-%d %H:%M:%S'): Failed to restart ${_service} service in ${_jail}." | tee -a "${bastille_monitor_logfile}" SERVICE_FAILED=1 fi @@ -174,7 +174,7 @@ for _jail in ${JAILS}; do fi else if [ -f "${bastille_jail_monitor}" ]; then - echo -n "${_jail}: " + info "\n[${_jail}]:" xargs < "${bastille_jail_monitor}" fi fi