#!/bin/sh
#----------------------------------------------------------------------------
# /var/install/bin/pre-setup-services-mariadb-tools-logfileview-menu
#
# Creation: 2012-02-25 hbfl
# Last Update: $Id$
#
# Copyright (c) 2012-@@YEAR@@ Holger Bruenjes, holgerbruenjes(at)gmxdot)net
#
# 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.
#----------------------------------------------------------------------------
#exec 2> /tmp/server-logfile-trace$$
#set -x
# ---------------------------------------------------------------------------
# create logfile view entry
# ---------------------------------------------------------------------------
create_logfile_view_menu()
{
{
echo ""View mysqld.log""
for l_file in ${logfiles}
do
l_dir=$(dirname "${l_file}")
l_mesg=$(basename "${l_file}")
fields=$(expr 1 + $(echo ${l_mesg} | awk -F. '{ print NF }'))
l_file=$(echo "${l_mesg}" | sed 's#\*#\\\*#g' )
logfiles=$(find ${l_dir} -maxdepth 1 -name "${l_file}.*" |
sort -t. -n -k${fields})
logfiles=$(echo "${logfiles}" | sed 's#\*#\\\*#g')
for t_file in ${logfiles}
do
t_mesg=$(basename "${t_file}")
t_file=$(echo "${t_file}" | sed 's#\*#\\\*#g')
echo ""View ${t_mesg}""
done
done
} >> /var/install/menu/setup.services.mariadb.tools.logfileview.menu
chmod 0640 /var/install/menu/setup.services.mariadb.tools.logfileview.menu
}
# ---------------------------------------------------------------------------
# create logfile view header
# ---------------------------------------------------------------------------
create_logfile_view_menu_header()
{
{
echo "
Logfile view"
echo "mariadb"
echo ""
echo ""
} > /var/install/menu/setup.services.mariadb.tools.logfileview.menu
chmod 0640 /var/install/menu/setup.services.mariadb.tools.logfileview.menu
}
# ---------------------------------------------------------------------------
# main
# ---------------------------------------------------------------------------
main()
{
logfiles='/var/log/mysqld/mysqld.log'
create_logfile_view_menu_header
create_logfile_view_menu
}
# ---------------------------------------------------------------------------
# exec main
# ---------------------------------------------------------------------------
main "${@}"
# ---------------------------------------------------------------------------
# end
# ---------------------------------------------------------------------------