mirror of
https://github.com/azlux/log2ram.git
synced 2023-10-10 13:37:24 +02:00
parent
9c774dcbb7
commit
e439c5ffdd
@ -3,7 +3,7 @@
|
|||||||
[ -d /var/hdd.log ] && echo "ERROR: log2ram still installed. Uninstall first!"
|
[ -d /var/hdd.log ] && echo "ERROR: log2ram still installed. Uninstall first!"
|
||||||
[ -d /var/hdd.log ] && exit 1
|
[ -d /var/hdd.log ] && exit 1
|
||||||
|
|
||||||
if [ `id -u` -eq 0 ]
|
if [ $(id -u) -eq 0 ]
|
||||||
then
|
then
|
||||||
cp log2ram.service /etc/systemd/system/log2ram.service
|
cp log2ram.service /etc/systemd/system/log2ram.service
|
||||||
chmod 644 /etc/systemd/system/log2ram.service
|
chmod 644 /etc/systemd/system/log2ram.service
|
||||||
|
6
log2ram
6
log2ram
@ -27,7 +27,7 @@ syncToDisk () {
|
|||||||
syncFromDisk () {
|
syncFromDisk () {
|
||||||
isSafe
|
isSafe
|
||||||
|
|
||||||
if [ ! -z `du -sh -t $SIZE $HDD_LOG/ | cut -f1` ]; then
|
if [ ! -z "$(du -sh -t "$SIZE" $HDD_LOG/ | cut -f1)" ]; then
|
||||||
echo "ERROR: RAM disk too small. Can't sync."
|
echo "ERROR: RAM disk too small. Can't sync."
|
||||||
umount -l $RAM_LOG/
|
umount -l $RAM_LOG/
|
||||||
umount -l $HDD_LOG/
|
umount -l $HDD_LOG/
|
||||||
@ -45,7 +45,7 @@ syncFromDisk () {
|
|||||||
}
|
}
|
||||||
|
|
||||||
wait_for () {
|
wait_for () {
|
||||||
while ! grep -qs $1 /proc/mounts; do
|
while ! grep -qs "$1" /proc/mounts; do
|
||||||
sleep 0.1
|
sleep 0.1
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
@ -56,7 +56,7 @@ case "$1" in
|
|||||||
mount --bind $RAM_LOG/ $HDD_LOG/
|
mount --bind $RAM_LOG/ $HDD_LOG/
|
||||||
mount --make-private $HDD_LOG/
|
mount --make-private $HDD_LOG/
|
||||||
wait_for $HDD_LOG
|
wait_for $HDD_LOG
|
||||||
mount -t tmpfs -o nosuid,noexec,nodev,mode=0755,size=$SIZE log2ram $RAM_LOG/
|
mount -t tmpfs -o nosuid,noexec,nodev,mode=0755,size="$SIZE" log2ram $RAM_LOG/
|
||||||
wait_for $RAM_LOG
|
wait_for $RAM_LOG
|
||||||
syncFromDisk
|
syncFromDisk
|
||||||
;;
|
;;
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
if [ `id -u` -eq 0 ]
|
if [ $(id -u) -eq 0 ]
|
||||||
then
|
then
|
||||||
service log2ram stop
|
service log2ram stop
|
||||||
systemctl disable log2ram
|
systemctl disable log2ram
|
||||||
|
Loading…
Reference in New Issue
Block a user