#!/bin/sh #---------------------------------------------------------------------------- # /var/install/bin/pre-setup-services-rsyslogd-logrotate-menu # # Creation: 2016-12-08 ansgar # Last Update: $Id$ # # Copyright (c) 2011-2022 the eisfair team, team(at)eisfair(dot)org # # Create menu for Manual logfile rotate # # 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. #---------------------------------------------------------------------------- . /var/install/include/eislib . /etc/config.d/rsyslogd #exec 2>/tmp/$(basename ${0})-trace$$.log #set -x # --------------------------------------------------------------------------- # create logfile rotate menu # --------------------------------------------------------------------------- create_logfile_rotate_menu () { dq='"' sq="'" idx=1 { while [ ${idx} -le ${RSYSLOGD_RULE_N} ] do eval active='${RSYSLOGD_RULE_'${idx}'_ACTIVE}' if [ "${active}" = "yes" ] then eval target='${RSYSLOGD_RULE_'${idx}'_ACTION}' # check actions default is 'false' is_file='false' act_char_1=${target:0:1} case "${act_char_1}" in '|') # | named pipe true ;; '@') # remote host true ;; '~') # discard true ;; '-') # -/ => file # strip - sign if [ "${act_char_1}" = '-' ] then target=${target:1} fi is_file='true' true ;; '/') # / => file # check /dev/ later is_file='true' true ;; '>') # database true ;; '^') # shell execute true ;; *) # user list ;; esac if [ ${is_file} = 'true' ] then # check for devices like /dev/console if echo "${target}" | grep -qv '^/dev/' then l_mesg=$(basename "${target}") # don't mask * #l_file=$(echo "${l_file}" | sed 's#\*#\\\*#g') # remove mask l_mesg=$(echo "${l_mesg}" | sed 's#\\##g') echo "" fi fi fi idx=$(/usr/bin/expr ${idx} + 1 ) done } >> /var/install/menu/setup.services.rsyslogd.logrotate.menu } # --------------------------------------------------------------------------- # create logfile rotate header # --------------------------------------------------------------------------- create_logfile_rotate_menu_header () { { echo "