Bugfix: check LOG_TYPE only at script start (#1417)

Only at start of the service since checking spins up attached mechanical drives and we don't want that. https://forum.armbian.com/topic/10406-armbian-ramlog-spin-up-all-hdds-once-every-day/
This commit is contained in:
Igor Pečovnik 2019-06-17 07:25:01 +02:00 committed by Thomas Kaiser
parent 3a38828345
commit 141ac0f7cd

View File

@ -43,7 +43,7 @@ RecreateLogs (){
syncToDisk () {
isSafe
echo -e "\n\n$(date): Syncing logs from $LOG_TYPE to storage\n" | $LOG_OUTPUT
echo -e "\n\n$(date): Syncing logs to storage\n" | $LOG_OUTPUT
if [ "$USE_RSYNC" = true ]; then
${NoCache} rsync -aXWv --delete --exclude "lost+found" --exclude armbian-ramlog.log --links $RAM_LOG $HDD_LOG 2>&1 | $LOG_OUTPUT
@ -57,7 +57,7 @@ syncToDisk () {
syncFromDisk () {
isSafe
echo -e "\n\n$(date): Loading logs from storage to $LOG_TYPE\n" | $LOG_OUTPUT
echo -e "\n\n$(date): Loading logs from storage\n" | $LOG_OUTPUT
if [ "$USE_RSYNC" = true ]; then
${NoCache} rsync -aXWv --delete --exclude "lost+found" --exclude armbian-ramlog.log --exclude *.gz --exclude='*.[0-9]' --links $HDD_LOG $RAM_LOG 2>&1 | $LOG_OUTPUT
@ -77,18 +77,18 @@ check_if_installed () {
fi
}
# Check whether zram device is available or we need to use tmpfs
if [ "$(blkid -s TYPE /dev/zram0 | awk ' { print $2 } ' | grep ext4)" ]; then
LOG_TYPE="zram"
else
LOG_TYPE="tmpfs"
fi
case "$1" in
start)
[ -d $HDD_LOG ] || mkdir -p $HDD_LOG
mount --bind $RAM_LOG $HDD_LOG
mount --make-private $HDD_LOG
# Check whether zram device is available or we need to use tmpfs
if [ "$(blkid -s TYPE /dev/zram0 | awk ' { print $2 } ' | grep ext4)" ]; then
LOG_TYPE="zram"
else
LOG_TYPE="tmpfs"
fi
case $LOG_TYPE in
zram)