diff --git a/install.sh b/install.sh index 94e7b9b..08aea60 100644 --- a/install.sh +++ b/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 diff --git a/log2ram b/log2ram index 032962b..297d514 100644 --- a/log2ram +++ b/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 diff --git a/log2ram.hourly b/log2ram.hourly new file mode 100644 index 0000000..df43424 --- /dev/null +++ b/log2ram.hourly @@ -0,0 +1,3 @@ +#! /bin/sh + +/usr/local/bin/log2ram write