blob: 18324534e5da257ed8d5269e45057c24a04a8848 [file] [log] [blame]
Artem Senicheve57ee762018-11-13 11:06:18 +03001#!/bin/bash
2#
3# config: 123 20
4# @brief: Collect host's logs
5#
6
7. ${DREPORT_INCLUDE}/functions
8
9DESCRIPTION="Host logs"
10LOGS_PATH="/var/lib/obmc/hostlogs"
11
12if [[ -d ${LOGS_PATH} ]]; then
Artem Senichev9b841d02020-07-15 15:53:01 +030013 # Manual flush of the log buffer for all service instances
14 INSTANCES="$(systemctl list-units --type=service --state=running --full | \
15 awk '/hostlogger@/{print $1}')"
16 for SVC in ${INSTANCES}; do
17 log_info "Flush ${SVC}..."
18 if ! systemctl kill --signal SIGUSR1 ${SVC}; then
19 log_warning "Unable to flush ${SVC}"
20 fi
21 done
22
Artem Senicheve57ee762018-11-13 11:06:18 +030023 # Copy log directory
24 add_copy_file "${LOGS_PATH}" "${DESCRIPTION}"
25fi