Du kan inte välja fler än 25 ämnen
Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.
|
- #!/usr/bin/env sh
-
- systemctl -q is-active log2ram && { echo "ERROR: log2ram service is still running. Please run \"sudo service log2ram stop\" to stop it."; exit 1; }
- [ "$(id -u)" -eq 0 ] || { echo "You need to be ROOT (sudo can be used)"; exit 1; }
-
- # log2ram
- mkdir -p /usr/local/bin/log2ram
- install -m 644 log2ram.service /etc/systemd/system/log2ram.service
- install -m 755 log2ram /usr/local/bin/log2ram/log2ram
- install -m 644 log2ram.conf /etc/log2ram.conf
- install -m 644 log2ram.conf /usr/local/bin/log2ram/log2ram-lastcheck
- install -m 644 uninstall.sh /usr/local/bin/log2ram/uninstall-log2ram.sh
- systemctl enable log2ram
-
- # cron
- install -m 755 log2ram.hourly /etc/cron.hourly/log2ram
- install -m 644 log2ram.logrotate /etc/logrotate.d/log2ram
-
- # Remove a previous log2ram version
- # ??
- # rm -rf /var/log.hdd
-
- # Make sure we start clean
- rm -rf /var/hdd.log
- # Make backup of pruned logs
- mkdir -p /var/oldlog
-
- cp -rfup /var/log/*.1 /var/oldlog/
- cp -rfup /var/log/*.gz /var/oldlog/
- cp -rfup /var/log/*.old /var/oldlog/
- # Prune logs
- rm -r /var/log/*.1
- rm -r /var/log/*.gz
- rm -r /var/log/*.old
- # Clone /var/log
- mkdir -p /var/hdd.log
- mkdir -p /var/log/oldlog
- # Prob better to use xcopy here with a --exclude
- rsync -a --exclude 'oldlog' /var/log/ /var/hdd.log/
- #cp -rfup /var/log/ -T /var/hdd.log/
- sed -i '/^include.*/i olddir /var/log/oldlog' /etc/logrotate.conf
-
- echo "##### Reboot to activate log2ram #####"
-
-
- echo "##### edit /etc/log2ram.conf to configure options #####"
|