From 815539b3da00d358fb4319149a71676fa2d3969d Mon Sep 17 00:00:00 2001 From: Dane Everitt Date: Thu, 17 Sep 2020 20:16:27 -0700 Subject: [PATCH] Fix log rotation error due to missing templates dir in compiled build --- config/config_system.go | 16 +++++++++++++++- templates/logrotate.tpl | 13 ------------- 2 files changed, 15 insertions(+), 14 deletions(-) delete mode 100644 templates/logrotate.tpl diff --git a/config/config_system.go b/config/config_system.go index 60c6727..ff19863 100644 --- a/config/config_system.go +++ b/config/config_system.go @@ -135,7 +135,21 @@ func (sc *SystemConfiguration) EnableLogRotation() error { } defer f.Close() - t, err := template.ParseFiles("templates/logrotate.tpl") + t, err := template.New("logrotate").Parse(` +{{.LogDirectory}}/wings.log { + size 10M + compress + delaycompress + dateext + maxage 7 + missingok + notifempty + create 0640 {{.User.Uid}} {{.User.Gid}} + postrotate + killall -SIGHUP wings + endscript +}`) + if err != nil { return errors.WithStack(err) } diff --git a/templates/logrotate.tpl b/templates/logrotate.tpl deleted file mode 100644 index d848699..0000000 --- a/templates/logrotate.tpl +++ /dev/null @@ -1,13 +0,0 @@ -{{.LogDirectory}}/wings.log { - size 10M - compress - delaycompress - dateext - maxage 7 - missingok - notifempty - create 0640 {{.User.Uid}} {{.User.Gid}} - postrotate - killall -SIGHUP wings - endscript -} \ No newline at end of file