浏览代码

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.
pull/8/head
Nick Daly 8 年前
父节点
当前提交
e238849069
共有 3 个文件被更改,包括 10 次插入2 次删除
  1. +4
    -2
      install.sh
  2. +3
    -0
      log2ram
  3. +3
    -0
      log2ram.hourly

+ 4
- 2
install.sh 查看文件

@@ -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
- 0
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
- 0
log2ram.hourly 查看文件

@@ -0,0 +1,3 @@
#! /bin/sh

/usr/local/bin/log2ram write

正在加载...
取消
保存