Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/nextcloudpi.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornachoparker <nacho@ownyourbits.com>2018-10-07 23:10:44 +0300
committernachoparker <nacho@ownyourbits.com>2018-10-07 23:10:44 +0300
commit48ac238f5bb71249afc5564e2bc6aab955663b9d (patch)
tree80dfa9da091cf3594aae5926c9d5a0e7f55c6d2a
parent694a885597727c93672c099d6056d710a0435b19 (diff)
limit logs size with logrotatev0.62.10
-rw-r--r--etc/ncp-config.d/UFW.sh3
-rw-r--r--ncp.sh13
-rwxr-xr-xupdate.sh17
3 files changed, 32 insertions, 1 deletions
diff --git a/etc/ncp-config.d/UFW.sh b/etc/ncp-config.d/UFW.sh
index b12380d3..3676e338 100644
--- a/etc/ncp-config.d/UFW.sh
+++ b/etc/ncp-config.d/UFW.sh
@@ -21,6 +21,9 @@ install()
apt-get update
DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends ufw
systemctl disable ufw
+
+ # Disable logging to kernel
+ grep -q maxsize /etc/logrotate.d/ufw || sed -i /weekly/amaxsize2M /etc/logrotate.d/ufw
}
configure()
diff --git a/ncp.sh b/ncp.sh
index 1fa2ae15..2ebf2da7 100644
--- a/ncp.sh
+++ b/ncp.sh
@@ -184,6 +184,19 @@ EOF
# update to latest version from github as part of the build process
bin/ncp-update $BRANCH
+ # LIMIT LOG SIZE
+ grep -q maxsize /etc/logrotate.d/apache2 || sed -i /weekly/amaxsize2M /etc/logrotate.d/apache2
+ cat >> /etc/logrotate.d/ncp <<'EOF'
+/var/log/ncp.log
+{
+ rotate 4
+ size 500K
+ missingok
+ notifempty
+ compress
+}
+EOF
+
# ONLY FOR IMAGE BUILDS
if [[ -f /.ncp-image ]]; then
rm -rf /var/log/ncp.log
diff --git a/update.sh b/update.sh
index a51777bb..f2f8ec82 100755
--- a/update.sh
+++ b/update.sh
@@ -216,7 +216,6 @@ Package: *
Pin: release n=stretch
Pin-Priority: 600
EOF
-
apt-get update
apt-get purge -y php7.0-*
@@ -288,6 +287,22 @@ EOF
URL="$(ncc config:system:get overwrite.cli.url)"
[[ "${URL: -1}" != "/" ]] && ncc config:system:set overwrite.cli.url --value="${URL}/"
+ # Implement logrotate restrictions
+ grep -q "^\& stop" /etc/rsyslog.d/20-ufw.conf || echo "& stop" >> /etc/rsyslog.d/20-ufw.conf
+ grep -q maxsize /etc/logrotate.d/ufw || sed -i /weekly/amaxsize2M /etc/logrotate.d/ufw
+ grep -q maxsize /etc/logrotate.d/apache2 || sed -i /weekly/amaxsize2M /etc/logrotate.d/apache2
+ service rsyslog restart
+ cat >> /etc/logrotate.d/ncp <<'EOF'
+/var/log/ncp.log
+{
+ rotate 4
+ size 500K
+ missingok
+ notifempty
+ compress
+}
+EOF
+
} # end - only live updates
exit 0