mail if error

This commit is contained in:
azlux 2017-07-18 00:46:54 +02:00
parent 150136da42
commit 2e55fa7bed
3 changed files with 10 additions and 1 deletions

View File

@ -18,10 +18,11 @@ sudo ./install.sh
## Customize
#### variables :
Into the file `/etc/log2ram.conf`, there are two variables :
Into the file `/etc/log2ram.conf`, there are three variables :
- The first variable define the size the log folder will reserve into the RAM.
- The second variable can be set to `true` if you prefer "rsync" than "cp". I use the command `cp -u` and `rsync -X`, I don't copy the all folder every time for optimization.
- The last varibale disable the error system mail if there are no enought place on RAM (if set on false)
#### refresh time:
The default is to write log into the HardDisk every hour. If you think this is too much, you can make the write every day by moving the cron file : `sudo mv /etc/cron.hourly/log2ram /etc/cron.daily/log2ram`.

View File

@ -29,6 +29,9 @@ syncFromDisk () {
echo "ERROR: RAM disk too small. Can't sync."
umount -l $RAM_LOG
umount -l $HDD_LOG
if [ "$MAIL" = true ]; then
echo "LOG2RAM : No place on RAM anymore, fallback on the disk" | mail -s 'Log2Ram Error' root;
fi
exit 1
fi

View File

@ -8,3 +8,8 @@ SIZE=40M
# You can choose which one you want. Be sure rsync is installed if you use it.
USE_RSYNC=false
# If there are some error with available RAM space, a system mail will be send
# Change it to false, and you will have only log if there are no place on RAM anymore.
MAIL=true