#! /bin/sh #---------------------------------------------------------------------------------- # /var/install/bin/stunnel-pre-view-log - extract log information # # Copyright (c) 2010-2020 The Eisfair Team, team(at)eisfair(dot)org # # Creation: 2010-12-07 jed # Last Update: $Id$ # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. #---------------------------------------------------------------------------------- # read eislib etc. . /var/install/include/check-eisfair-version # set platform specific parameters case ${EISFAIR_SYSTEM} in eisfair-1) # eisfair-1 log_file=/var/log/messages ;; *) # eisfair-2 log_file='/var/log/messages /var/log/debug' ;; esac log_tmp_file=/tmp/messages.stunnel lfile_exist=1 for lfile in ${log_file} do if [ -s ${lfile} ] then lfile_exist=0 break fi done if [ ${lfile_exist} -eq 0 ] then # at least one log file exists # -h suppress leading file name grep -h " stunnel:" ${log_file} > ${log_tmp_file} if [ $? -ne 0 ] then echo "Info: Nothing has been logged until now." > ${log_tmp_file} else # sort output mv ${log_tmp_file} ${log_tmp_file}.tmp sort ${log_tmp_file}.tmp > ${log_tmp_file} rm -f ${log_tmp_file}.tmp fi else echo "Warning: Logfile ${log_file} not found or empty!" > ${log_tmp_file} fi