From 8ebfdd217c88c7cb4b0e7f4feb37bfd963757f05 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Lebleu?= Date: Thu, 12 Nov 2015 13:14:38 +0100 Subject: [PATCH] [enh] Add logrotate configuration --- debian/logrotate | 11 +++++++++++ debian/yunohost-api.init | 13 +++++++++++++ 2 files changed, 24 insertions(+) create mode 100644 debian/logrotate diff --git a/debian/logrotate b/debian/logrotate new file mode 100644 index 000000000..0bc07ca59 --- /dev/null +++ b/debian/logrotate @@ -0,0 +1,11 @@ +/var/log/yunohost/*.log { + weekly + rotate 4 + delaycompress + compress + notifempty + missingok + postrotate + invoke-rc.d yunohost-api rotate >/dev/null 2>&1 + endscript +} diff --git a/debian/yunohost-api.init b/debian/yunohost-api.init index 0a27554d2..bd9f3a015 100755 --- a/debian/yunohost-api.init +++ b/debian/yunohost-api.init @@ -75,6 +75,14 @@ do_reload() { return 0 } +# +# Function called when rotating logs +# +do_rotate() { + start-stop-daemon --stop --signal USR1 --quiet --pidfile $PID --name $NAME + return 0 +} + case "$1" in start) [ "$VERBOSE" != no ] && log_daemon_msg "Starting $DESC" "$NAME" @@ -118,6 +126,11 @@ case "$1" in ;; esac ;; + rotate) + log_daemon_msg "Re-opening $DESC log files" "$NAME" + do_rotate + log_end_msg $? + ;; *) echo "Usage: $SCRIPTNAME {start|stop|status|restart|reload}" >&2 exit 3