|
@@ -8,6 +8,7 @@ RAM_LOG=/var/log |
|
|
LOG_NAME="log2ram.log" |
|
|
LOG_NAME="log2ram.log" |
|
|
LOG2RAM_LOG="${RAM_LOG}/${LOG_NAME}" |
|
|
LOG2RAM_LOG="${RAM_LOG}/${LOG_NAME}" |
|
|
LOG_OUTPUT="tee -a $LOG2RAM_LOG" |
|
|
LOG_OUTPUT="tee -a $LOG2RAM_LOG" |
|
|
|
|
|
printf -v NOW '%(%F %H:%M:%S)T' -1 # Actual Date and Time |
|
|
|
|
|
|
|
|
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." |
|
@@ -17,6 +18,7 @@ isSafe () { |
|
|
syncToDisk () { |
|
|
syncToDisk () { |
|
|
isSafe |
|
|
isSafe |
|
|
|
|
|
|
|
|
|
|
|
echo "$NOW - Syncing to disk" | $LOG_OUTPUT |
|
|
if [ "$USE_RSYNC" = true ]; then |
|
|
if [ "$USE_RSYNC" = true ]; then |
|
|
rsync -aXv --inplace --no-whole-file --delete-after $RAM_LOG/ $HDD_LOG/ 2>&1 | $LOG_OUTPUT |
|
|
rsync -aXv --inplace --no-whole-file --delete-after $RAM_LOG/ $HDD_LOG/ 2>&1 | $LOG_OUTPUT |
|
|
else |
|
|
else |
|
@@ -37,6 +39,7 @@ syncFromDisk () { |
|
|
exit 1 |
|
|
exit 1 |
|
|
fi |
|
|
fi |
|
|
|
|
|
|
|
|
|
|
|
echo "$NOW - Syncing from disk" | $LOG_OUTPUT |
|
|
if [ "$USE_RSYNC" = true ]; then |
|
|
if [ "$USE_RSYNC" = true ]; then |
|
|
rsync -aXv --inplace --no-whole-file --delete-after $HDD_LOG/ $RAM_LOG/ 2>&1 | $LOG_OUTPUT |
|
|
rsync -aXv --inplace --no-whole-file --delete-after $HDD_LOG/ $RAM_LOG/ 2>&1 | $LOG_OUTPUT |
|
|
else |
|
|
else |
|
|