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:
Nick Daly 2016-11-30 11:41:41 -06:00
parent 7d825982ae
commit e238849069
3 changed files with 10 additions and 2 deletions

View File

@ -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

View File

@ -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
View File

@ -0,0 +1,3 @@
#! /bin/sh
/usr/local/bin/log2ram write