drop.chapril.org-tools/rapports_activites/rapport_activites.sh

51 lines
1.7 KiB
Bash
Executable File

#! /bin/bash
#
# Copyright (C) 2020 Christian MOMON <cmomon@april.ogr>
#
# This file is part of drop.chapril.org
#
# This script is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
# ============================================
# This scripts extracts and writes plain text report on stdout
# ============================================
# Configuration files.
DATA_DIRECTORY="/var/drop/"
# Generate report
echo "Rapport d'activité du service drop.chapril.org au "`date "+%-d %B %Y"`
echo
echo "================================================================="
echo
echo -e "================================================================="
echo
fileCount=$(find "$DATA_DIRECTORY" | wc -l)
echo "Nombre fichiers = $fileCount"
usedDiskSpace=$(du -sh "$DATA_DIRECTORY" | awk '{ print $1 }')
echo "Espace disque utilisé = $usedDiskSpace"
freeDiskSpace=$(df -h "$DATA_DIRECTORY" | tail -1 | awk '{ print $4 }')
echo "Espace disque libre = $freeDiskSpace"
# Addition des infos HTTP.
/srv/drop.chapril.org/tools/rapports_activites/rapport_activites_http.sh -p