Skip to content

Commit

Permalink
Changed config to /etc/sysreporter/sysreporter.conf
Browse files Browse the repository at this point in the history
In the debian package the reports are also located in /etc/sysreporter

Also added check/creation for TEMPDIR.
  • Loading branch information
lfkeitel committed Dec 12, 2015
1 parent 88ee263 commit 06a65ee
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
15 changes: 13 additions & 2 deletions sysreport
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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"
}
Expand Down Expand Up @@ -100,6 +110,7 @@ cmd_enable_disable() {
}

cmd_run() {
checkTmpDir
cleanup
print_header "$TITLE"

Expand Down

0 comments on commit 06a65ee

Please sign in to comment.