#! /bin/sh
#----------------------------------------------------------------------------
# /var/install/bin/pre-setup-services-logfileview-nginx-menu
#
# Creation: 2012-02-24 ap
# Last Update: $Id$
#
# Copyright (c) 2012-2022 the eisfair team, team(at)eisfair(dot)org
#
# 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.
#----------------------------------------------------------------------------
nginxfile=/etc/config.d/nginx
menu_file=/var/install/menu/setup.services.logfileview.nginx.menu
# read configuration
. $nginxfile
# NGINX_ACCESS_LOG='off'
if [ "$NGINX_ACCESS_LOG" = 'off' ]
then
{
echo "NGINX_ACCESS_LOG was set to 'off'"
echo "No access log available"
} > /tmp/nginx_access_log_error.txt
NGINX_ACCESS_LOG=/tmp/nginx_access_log_error.txt
fi
# NGINX_ACCESS_LOG starts with syslog:server=
access_start=$(echo $NGINX_ACCESS_LOG | cut -c 1-14)
if [ "$access_start" = 'syslog:server=' ]
then
{
echo "NGINX_ACCESS_LOG was redirected to a syslog server"
echo "No access log file to display"
} > /tmp/nginx_access_log_error.txt
NGINX_ACCESS_LOG=/tmp/nginx_access_log_error.txt
fi
# NGINX_ERROR_LOG starts with syslog:server=
error_start=$(echo $NGINX_ERROR_LOG | cut -c 1-14)
if [ "$error_start" = 'syslog:server=' ]
then
{
echo "NGINX_ERROR_LOG was redirected to a syslog server"
echo "No access log file to display"
} > /tmp/nginx_error_log_error.txt
NGINX_ERROR_LOG=/tmp/nginx_error_log_error.txt
fi
# Check if absolute filenames or relative filenames
access_start=$(echo $NGINX_ACCESS_LOG | cut -c 1)
if [ ! "$access_start" = '/' ]
then
NGINX_ACCESS_LOG="/var/log/nginx/$NGINX_ACCESS_LOG"
fi
error_start=$(echo $NGINX_ERROR_LOG | cut -c 1)
if [ ! "$error_start" = '/' ]
then
NGINX_ERROR_LOG="/var/log/nginx/$NGINX_ERROR_LOG"
fi
{
echo ""
echo "