From 06a65eeb83d3d88ec24f71a2efcd8002545f19a7 Mon Sep 17 00:00:00 2001 From: Lee Keitel Date: Fri, 11 Dec 2015 22:00:38 -0600 Subject: [PATCH] Changed config to /etc/sysreporter/sysreporter.conf In the debian package the reports are also located in /etc/sysreporter Also added check/creation for TEMPDIR. --- README.md | 2 +- sysreport | 15 +++++++++++++-- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 0d7c885..8dcb12b 100644 --- a/README.md +++ b/README.md @@ -14,7 +14,7 @@ Install 1. Move the SysReporter directory to a place of your choosing 2. Move sysreporter.conf to /etc -3. Edit /etc/sysreporter.conf and fill in the server name variable and the email addresses to send the report (separated by comma). +3. Edit /etc/sysreporter/sysreporter.conf and fill in the server name variable and the email addresses to send the report (separated by comma). 4. Install and setup ssmtp if you would like to receive the reports via email 5. Setup a cron job to run periodically 6. The default reports `31-DiskCPUio`, `35-processStats`, and `36-sar` require the sysstat package. If this package is not installed the reports won't run. If you want to use any of these reports follow these instructions: diff --git a/sysreport b/sysreport index 59fcc1c..d11d0f0 100755 --- a/sysreport +++ b/sysreport @@ -19,8 +19,8 @@ echoError() { } # Import server specific configuration -if [ -f /etc/sysreporter.conf ]; then - source /etc/sysreporter.conf +if [ -f /etc/sysreporter/sysreporter.conf ]; then + source /etc/sysreporter/sysreporter.conf elif [ -f "$DIR/sysreporter.conf" ]; then source "$DIR/sysreporter.conf" else @@ -52,6 +52,16 @@ cleanup() { cat /dev/null > "$TEMPMAIL" } +checkTmpDir() { + if [ ! -d "$TEMPDIR" ]; then + mkdir -p "$TEMPDIR" + if [ $? != 0 ]; then + echoError "Can't make temporary directory $TEMPDIR" + exit 1 + fi + fi +} + print_to_report() { echo -e "$1" >> "$LOGFILE" } @@ -100,6 +110,7 @@ cmd_enable_disable() { } cmd_run() { + checkTmpDir cleanup print_header "$TITLE"