Pārlūkot izejas kodu

Merge pull request #39 from nhuizing/feature/logrotate

Added logrotate support
pull/44/head
azlux pirms 6 gadiem
committed by GitHub
vecāks
revīzija
e88f67ab23
Šim parakstam datu bāzē netika atrasta zināma atslēga GPG atslēgas ID: 4AEE18F83AFDEB23
5 mainītis faili ar 17 papildinājumiem un 5 dzēšanām
  1. +1
    -1
      README.md
  2. +2
    -0
      install.sh
  3. +3
    -4
      log2ram
  4. +10
    -0
      log2ram.logrotate
  5. +1
    -0
      uninstall.sh

+ 1
- 1
README.md Parādīt failu

@@ -36,7 +36,7 @@ mount

If you have issue with apache2, you can try to add `apache2.service` next to other services on the `Before` parameter in `/etc/systemd/system/log2ram.service` it will solve the pb

The log for log2ram will be written at: `/var/hdd.log/log2ram.log`
The log for log2ram will be written at: `/var/log/log2ram.log`

###### Now, muffins for everyone!



+ 2
- 0
install.sh Parādīt failu

@@ -14,6 +14,8 @@ then
systemctl enable log2ram
cp log2ram.hourly /etc/cron.hourly/log2ram
chmod +x /etc/cron.hourly/log2ram
cp log2ram.logrotate /etc/logrotate.d/log2ram
chmod 644 /etc/logrotate.d/log2ram

# Remove a previous log2ram version
if [ -d /var/log.hdd ]; then


+ 3
- 4
log2ram Parādīt failu

@@ -6,7 +6,7 @@ HDD_LOG=/var/hdd.log
RAM_LOG=/var/log

LOG_NAME="log2ram.log"
LOG2RAM_LOG="${HDD_LOG}/${LOG_NAME}"
LOG2RAM_LOG="${RAM_LOG}/${LOG_NAME}"
LOG_OUTPUT="tee -a $LOG2RAM_LOG"

isSafe () {
@@ -18,7 +18,7 @@ syncToDisk () {
isSafe

if [ "$USE_RSYNC" = true ]; then
rsync -aXWv --delete --exclude $LOG_NAME --links $RAM_LOG/ $HDD_LOG/ 2>&1 | $LOG_OUTPUT
rsync -aXWv --delete --links $RAM_LOG/ $HDD_LOG/ 2>&1 | $LOG_OUTPUT
else
cp -rfup $RAM_LOG/ -T $HDD_LOG/ 2>&1 | $LOG_OUTPUT
fi
@@ -38,7 +38,7 @@ syncFromDisk () {
fi

if [ "$USE_RSYNC" = true ]; then
rsync -aXWv --delete --exclude $LOG_NAME --links $HDD_LOG/ $RAM_LOG/ 2>&1 | $LOG_OUTPUT
rsync -aXWv --delete --links $HDD_LOG/ $RAM_LOG/ 2>&1 | $LOG_OUTPUT
else
cp -rfup $HDD_LOG/ -T $RAM_LOG/ 2>&1 | $LOG_OUTPUT
fi
@@ -56,7 +56,6 @@ case "$1" in
mount --bind $RAM_LOG/ $HDD_LOG/
mount --make-private $HDD_LOG/
wait_for $HDD_LOG
rm -f $LOG2RAM_LOG
mount -t tmpfs -o nosuid,noexec,nodev,mode=0755,size=$SIZE log2ram $RAM_LOG/
wait_for $RAM_LOG
syncFromDisk


+ 10
- 0
log2ram.logrotate Parādīt failu

@@ -0,0 +1,10 @@
/var/log/log2ram.log
{
rotate 7
daily
missingok
notifempty
delaycompress
compress
}


+ 1
- 0
uninstall.sh Parādīt failu

@@ -8,6 +8,7 @@ then
rm /usr/local/bin/log2ram
rm /etc/log2ram.conf
rm /etc/cron.hourly/log2ram
rm /etc/logrotate.d/log2ram

if [ -d /var/hdd.log ]; then
rm -r /var/hdd.log


Notiek ielāde…
Atcelt
Saglabāt