commit:     398256d5a7bb8a7717e656587272e271e76c15c7
Author:     tiotags <tiotags1 <AT> gmail <DOT> com>
AuthorDate: Mon Apr 19 07:50:00 2021 +0000
Commit:     Andrew Ammerlaan <andrewammerlaan <AT> riseup <DOT> net>
CommitDate: Mon Apr 19 07:50:37 2021 +0000
URL:        https://gitweb.gentoo.org/repo/proj/guru.git/commit/?id=398256d5

www-servers/hinsightd: added logrotate script and systemd unit

Package-Manager: Portage-3.0.18, Repoman-3.0.3
Signed-off-by: Alexandru Campeanu <tiotags1 <AT> gmail.com>

 www-servers/hinsightd/files/hinsightd.service | 10 ++++++++++
 www-servers/hinsightd/files/logrotate.d.sh    | 14 ++++++++++++++
 www-servers/hinsightd/hinsightd-9999.ebuild   |  5 +++++
 3 files changed, 29 insertions(+)

diff --git a/www-servers/hinsightd/files/hinsightd.service 
b/www-servers/hinsightd/files/hinsightd.service
new file mode 100644
index 000000000..02215732e
--- /dev/null
+++ b/www-servers/hinsightd/files/hinsightd.service
@@ -0,0 +1,10 @@
+[Unit]
+Description=hinsightd is a http/1.1 webserver
+After=syslog.target network.target
+
+[Service]
+ExecStart=/usr/bin/hinsightd --config /etc/hinsightd/hinsightd.lua
+ExecReload=/bin/kill -USR1 $MAINPID
+
+[Install]
+WantedBy=multi-user.target

diff --git a/www-servers/hinsightd/files/logrotate.d.sh 
b/www-servers/hinsightd/files/logrotate.d.sh
new file mode 100644
index 000000000..3483c001f
--- /dev/null
+++ b/www-servers/hinsightd/files/logrotate.d.sh
@@ -0,0 +1,14 @@
+/var/log/hinsightd/*.log {
+daily
+missingok
+rotate 7
+compress
+delaycompress
+minsize 1M
+notifempty
+sharedscripts
+postrotate
+       test -e /run/openrc/softlevel && /etc/init.d/hinsightd reload 
1>/dev/null || true
+       test -e /run/systemd/system && systemctl reload hinsightd.service || 
true
+endscript
+}

diff --git a/www-servers/hinsightd/hinsightd-9999.ebuild 
b/www-servers/hinsightd/hinsightd-9999.ebuild
index fc2323148..bdb8dbee6 100644
--- a/www-servers/hinsightd/hinsightd-9999.ebuild
+++ b/www-servers/hinsightd/hinsightd-9999.ebuild
@@ -45,10 +45,15 @@ src_compile() {
 src_install() {
        newbin "${S}/build/hin9" hinsightd
        newinitd "${FILESDIR}/init.d.sh" hinsightd
+       #systemd_dounit "${FILESDIR}/hinsightd.service" # not tested
 
        insinto /etc/hinsightd
        newins "${S}/workdir/main.lua" hinsightd.lua
 
+       # logrotate
+       insinto /etc/logrotate.d
+       newins "${FILESDIR}"/logrotate.d.sh hinsightd
+
        keepdir /var/www/localhost/htdocs
        keepdir /var/log/hinsightd
        keepdir /var/tmp/hinsightd

Reply via email to