#!/bin/sh #---------------------------------------------------------------------------- # /var/install/bin/rsyslogd-tools-logger-test rsyslogd logger test script # # Copyright (c) 2001-2022 Ansgar Puester # # Creation: 29.12.2014 ap # 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. #---------------------------------------------------------------------------- # include base configuration . /etc/config.d/base # include eislib . /var/install/include/eislib #exec 2>/tmp/$(basename ${0})-trace$$.log #set -x mecho --info "rsyslogd logger test script" export FACILITY_TITLE='Logger test skript' export FACILITY_SUBTITLE='Facility' export FACILITY_QUESTION='Select facility:' export FACILITY_COLS="10" export FACILITY_ROWS=22 export FACILITY_FLAGS='' export FACILITY_1_1='auth' export FACILITY_2_1='authpriv' export FACILITY_3_1='cron' export FACILITY_4_1='daemon' export FACILITY_5_1='kern' export FACILITY_6_1='lpr' export FACILITY_7_1='mail' export FACILITY_8_1='mark' export FACILITY_9_1='news' export FACILITY_10_1='syslog' export FACILITY_11_1='user' export FACILITY_12_1='uucp' export FACILITY_13_1='ftp' export FACILITY_14_1='local0' export FACILITY_15_1='local1' export FACILITY_16_1='local2' export FACILITY_17_1='local3' export FACILITY_18_1='local4' export FACILITY_19_1='local5' export FACILITY_20_1='local6' export FACILITY_21_1='local7' export FACILITY_22_1='\*' _ask_tmpfile=$(/bin/mktemp -t XXXXXXXXXXXXX) /var/install/bin/choose FACILITY 1 > ${_ask_tmpfile} rc=${?} read answer < ${_ask_tmpfile} rm -f ${_ask_tmpfile} [ $rc = 255 ] && exit 255 [ "$answer" = '' ] && answer=0 #echo "Debug: answer=$answer" eval act_facility='$FACILITY_'${answer}'_1' [ "$act_facility" = '\*' ] && act_facility='auth authpriv cron daemon kern lpr mail mark news syslog user uucp ftp local0 local1 local2 local3 local4 local5 local6 local7' #echo "Debug: act_facility=$act_facility" if [ ! "$answer" = '0' ] then export PRIORITY_TITLE='Logger test skript' export PRIORITY_SUBTITLE='Priority' export PRIORITY_QUESTION='Select priority:' export PRIORITY_COLS="10" export PRIORITY_ROWS=9 export PRIORITY_FLAGS='' export PRIORITY_1_1='debug' export PRIORITY_2_1='info' export PRIORITY_3_1='notice' export PRIORITY_4_1='warning' export PRIORITY_5_1='err' export PRIORITY_6_1='crit' export PRIORITY_7_1='alert' export PRIORITY_8_1='emerg' export PRIORITY_9_1='\*' _ask_tmpfile=$(/bin/mktemp -t XXXXXXXXXXXXX) /var/install/bin/choose PRIORITY 1 > ${_ask_tmpfile} rc=${?} read answer < ${_ask_tmpfile} rm -f ${_ask_tmpfile} [ $rc = 255 ] && exit 255 [ "$answer" = '' ] && answer=0 #echo "Debug: answer=$answer" eval act_priority='$PRIORITY_'${answer}'_1' [ "$act_priority" = '\*' ] && act_priority='debug info notice warning err crit alert emerg' #echo "Debug: act_priority=$act_priority" if [ ! "$answer" = '0' ] then _ask_tmpfile=$(/bin/mktemp -t XXXXXXXXXXXXX) /var/install/bin/ask "Count" "1" "1-5" "0=Exit" > ${_ask_tmpfile} rc=${?} read answer < ${_ask_tmpfile} rm -f ${_ask_tmpfile} [ $rc = 255 ] && exit 255 [ "$answer" = '' ] && answer=0 if [ ! "$answer" = '0' ] then count=$answer _ask_tmpfile=$(/bin/mktemp -t XXXXXXXXXXXXX) /var/install/bin/ask "Sleep (seconds)" "1" "1-10" "0=Exit" > ${_ask_tmpfile} rc=${?} read answer < ${_ask_tmpfile} rm -f ${_ask_tmpfile} [ $rc = 255 ] && exit 255 [ "$answer" = '' ] && answer=0 sleep=$answer idx=1 while [ "$idx" -le "$count" ] do for facility in $act_facility do for priority in $act_priority do #echo "Debug: $facility.$priority" logger -t 'logger' -i -p $facility.$priority "Testmessage from $HOSTNAME.$DOMAIN_NAME ($facility:$priority)" done done [ "$idx" -lt "$count" ] && sleep $sleep idx=`expr $idx + 1` done fi fi fi anykey