mirror of
https://github.com/azlux/log2ram.git
synced 2023-10-10 13:37:24 +02:00
Sync the ramlog back to disk, hourly.
- Since the cron job could be called before the user reboots after install (or if log2ram is disabled), we check that the hdd log location exists before syncing. - Copy the log2ram.hourly sync script to cron's hourly directory on install.
This commit is contained in:
parent
7d825982ae
commit
e238849069
@ -7,8 +7,10 @@ then
|
||||
cp log2ram /usr/local/bin/log2ram
|
||||
chmod a+x /usr/local/bin/log2ram
|
||||
systemctl enable log2ram
|
||||
|
||||
cp log2ram.hourly /etc/cron.hourly/log2ram
|
||||
chmod +x /etc/cron.hourly/log2ram
|
||||
|
||||
echo "Reboot to activate log2ram"
|
||||
else
|
||||
else
|
||||
echo "You need to be ROOT (sudo can be used)"
|
||||
fi
|
||||
|
3
log2ram
3
log2ram
@ -7,6 +7,9 @@ SIZE=40M
|
||||
USE_RSYNC=false
|
||||
|
||||
sync () {
|
||||
[ -d $HDD_LOG ] || echo "ERROR: $HDD_LOG doesn't exist! Can't sync."
|
||||
[ -d $HDD_LOG ] || exit 1
|
||||
|
||||
if [ "$USE_RSYNC" = true ]; then
|
||||
rsync -aXWv --delete --links $HDD_LOG $RAM_LOG 2>&1 | tee -a $LOG2RAM_LOG
|
||||
else
|
||||
|
3
log2ram.hourly
Normal file
3
log2ram.hourly
Normal file
@ -0,0 +1,3 @@
|
||||
#! /bin/sh
|
||||
|
||||
/usr/local/bin/log2ram write
|
Loading…
Reference in New Issue
Block a user