mirror of
https://github.com/azlux/log2ram
synced 2024-11-23 13:56:30 +00:00
Compare commits
3 Commits
500e87f68c
...
5b097683af
Author | SHA1 | Date | |
---|---|---|---|
5b097683af | |||
|
9a4cbf54c2 | ||
|
7f810f6f25 |
@ -66,12 +66,13 @@ You need to stop log2ram (`service log2ram stop`) and start the [install](#insta
|
|||||||
|
|
||||||
## Customize
|
## Customize
|
||||||
#### variables :
|
#### variables :
|
||||||
In the file `/etc/log2ram.conf`, there are three variables:
|
In the file `/etc/log2ram.conf`, there are five variables:
|
||||||
|
|
||||||
- `SIZE`: defines the size the log folder will reserve into the RAM (default is 40M).
|
- `SIZE`: defines the size the log folder will reserve into the RAM (default is 40M).
|
||||||
- `MAIL`: Disables the error system mail if there is not enough place on RAM (if set to `false`)
|
- `USE_RSYNC`: (commented out by default = `true`) use `cp` instead of `rsync` (if set to `false`).
|
||||||
- `PATH_DISK`: activate log2ram for other path than default one. Paths should be separated with a `;`
|
- `MAIL`: disables the error system mail if there is not enough place on RAM (if set to `false`).
|
||||||
- `ZL2R`: Enable zram compatibility (`false` by default). Check the comment on the config file. See https://github.com/StuartIanNaylor/zram-swap-config to configure a zram space on your raspberry before enable this option.
|
- `PATH_DISK`: activate log2ram for other path than default one. Paths should be separated with a `;`.
|
||||||
|
- `ZL2R`: enable zram compatibility (`false` by default). Check the comment on the config file. See https://github.com/StuartIanNaylor/zram-swap-config to configure a zram space on your raspberry before enable this option.
|
||||||
|
|
||||||
#### refresh time:
|
#### refresh time:
|
||||||
By default Log2Ram writes to disk every day. If you think this is too much, you can run `systemctl edit log2ram-daily.timer` and add:
|
By default Log2Ram writes to disk every day. If you think this is too much, you can run `systemctl edit log2ram-daily.timer` and add:
|
||||||
|
6
log2ram
6
log2ram
@ -7,7 +7,7 @@ if [ -z "$PATH_DISK" ]; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
LOG_NAME='log2ram.log'
|
LOG_NAME='log2ram.log'
|
||||||
|
NO_RSYNC=${USE_RSYNC#true}
|
||||||
|
|
||||||
isSafe () {
|
isSafe () {
|
||||||
[ -d "$HDD_LOG" ] || echo "ERROR: $HDD_LOG/ doesn't exist! Can't sync."
|
[ -d "$HDD_LOG" ] || echo "ERROR: $HDD_LOG/ doesn't exist! Can't sync."
|
||||||
@ -22,7 +22,7 @@ remountOriginal() {
|
|||||||
syncToDisk () {
|
syncToDisk () {
|
||||||
isSafe
|
isSafe
|
||||||
|
|
||||||
if [ -x "$(command -v rsync)" ]; then
|
if [ -z "${NO_RSYNC}" -a -x "$(command -v rsync)" ]; then
|
||||||
rsync -aXv --inplace --no-whole-file --delete-after "$RAM_LOG"/ "$HDD_LOG"/ 2>&1 | tee -a "$LOG2RAM_LOG"
|
rsync -aXv --inplace --no-whole-file --delete-after "$RAM_LOG"/ "$HDD_LOG"/ 2>&1 | tee -a "$LOG2RAM_LOG"
|
||||||
else
|
else
|
||||||
cp -rfup "$RAM_LOG"/ -T "$HDD_LOG"/ 2>&1 | tee -a "$LOG2RAM_LOG"
|
cp -rfup "$RAM_LOG"/ -T "$HDD_LOG"/ 2>&1 | tee -a "$LOG2RAM_LOG"
|
||||||
@ -47,7 +47,7 @@ syncFromDisk () {
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -x "$(command -v rsync)" ]; then
|
if [ -z "${NO_RSYNC}" -a -x "$(command -v rsync)" ]; then
|
||||||
rsync -aXv --inplace --no-whole-file --delete-after "$HDD_LOG"/ "$RAM_LOG"/ 2>&1 | tee -a "$LOG2RAM_LOG"
|
rsync -aXv --inplace --no-whole-file --delete-after "$HDD_LOG"/ "$RAM_LOG"/ 2>&1 | tee -a "$LOG2RAM_LOG"
|
||||||
else
|
else
|
||||||
cp -rfup "$HDD_LOG"/ -T "$RAM_LOG"/ 2>&1 | tee -a "$LOG2RAM_LOG"
|
cp -rfup "$HDD_LOG"/ -T "$RAM_LOG"/ 2>&1 | tee -a "$LOG2RAM_LOG"
|
||||||
|
@ -7,6 +7,13 @@
|
|||||||
# You will need to increase it if you have a server and a lot of log for example.
|
# You will need to increase it if you have a server and a lot of log for example.
|
||||||
SIZE=40M
|
SIZE=40M
|
||||||
|
|
||||||
|
# Select the log syncing method between the log directory on disk and in the RAM.
|
||||||
|
# The variable may be uncommented out, setting it to false, if "cp" is preferred over "rsync".
|
||||||
|
# Currently, this option needs to be unset or set to true for "rsync" to run,
|
||||||
|
# with "cp" available for fallback when "rsync" is missing.
|
||||||
|
# In all other cases, setting USE_RSYNC to anything other than true will default to "cp".
|
||||||
|
#USE_RSYNC=false
|
||||||
|
|
||||||
# If there are some errors with available RAM space, a system mail will be send
|
# If there are some errors with available RAM space, a system mail will be send
|
||||||
# Change it to false and you will have only a log if there is no place on RAM anymore.
|
# Change it to false and you will have only a log if there is no place on RAM anymore.
|
||||||
MAIL=true
|
MAIL=true
|
||||||
|
Loading…
Reference in New Issue
Block a user