aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorBernard Spil <brnrd@FreeBSD.org>2021-05-31 19:24:30 +0800
committerBernard Spil <brnrd@FreeBSD.org>2021-05-31 19:24:30 +0800
commit3aa7a82534ec67d837a2e305480b45007f3d9b15 (patch)
treed7238e0b1827ecb10cf37f53fc427a43badcdfc2 /net
parent164f9966b49979962c36d5a43b4d1bb7f8a0877e (diff)
downloadfreebsd-ports-gnome-3aa7a82534ec67d837a2e305480b45007f3d9b15.tar.gz
freebsd-ports-gnome-3aa7a82534ec67d837a2e305480b45007f3d9b15.tar.zst
freebsd-ports-gnome-3aa7a82534ec67d837a2e305480b45007f3d9b15.zip
net/endlessh: Add log rotation
PR: 256286
Diffstat (limited to 'net')
-rw-r--r--net/endlessh/Makefile9
-rw-r--r--net/endlessh/files/endlessh.in3
-rw-r--r--net/endlessh/files/endlessh.newsyslog.conf11
-rw-r--r--net/endlessh/files/pkg-message.in (renamed from net/endlessh/pkg-message)17
4 files changed, 34 insertions, 6 deletions
diff --git a/net/endlessh/Makefile b/net/endlessh/Makefile
index 8a0319f8f77c..66636d3ea333 100644
--- a/net/endlessh/Makefile
+++ b/net/endlessh/Makefile
@@ -15,7 +15,10 @@ GH_ACCOUNT= skeeto
PLIST_FILES= bin/endlessh \
man/man1/endlessh.1.gz \
- "@sample ${PREFIX}/etc/endlessh.conf.sample"
+ "@sample ${PREFIX}/etc/endlessh.conf.sample" \
+ ${PREFIX}/etc/endlessh.newsyslog.conf
+
+SUB_FILES= pkg-message
post-patch:
${REINPLACE_CMD} 's|share/man|man|;s|/usr/local|${PREFIX}|' ${WRKSRC}/Makefile
@@ -23,6 +26,8 @@ post-patch:
${WRKSRC}/endlessh.c ${WRKSRC}/endlessh.1
post-install:
- ${INSTALL_DATA} ${FILESDIR}/endlessh.conf.sample ${STAGEDIR}${PREFIX}/etc/
+ ${INSTALL_DATA} ${FILESDIR}/endlessh.newsyslog.conf \
+ ${FILESDIR}/endlessh.conf.sample ${STAGEDIR}${PREFIX}/etc/
+ ${STRIP} ${STAGEDIR}${PREFIX}/bin/endlessh
.include <bsd.port.mk>
diff --git a/net/endlessh/files/endlessh.in b/net/endlessh/files/endlessh.in
index f54ab6b46f4e..abc5ec9d59cf 100644
--- a/net/endlessh/files/endlessh.in
+++ b/net/endlessh/files/endlessh.in
@@ -26,8 +26,9 @@ load_rc_config $name
: ${endlessh_logfile:=/var/log/endlessh.log}
pidfile=/var/run/endlessh.pid
+daemonpidfile=/var/run/daemon_endlessh.pid
procname="%%PREFIX%%/bin/endlessh"
command=/usr/sbin/daemon
-command_args='-p ${pidfile} -u ${endlessh_daemonuser} -o ${endlessh_logfile} ${procname} -f ${endlessh_config} ${endlessh_args}'
+command_args='-p ${pidfile} -P ${daemonpidfile} -u ${endlessh_daemonuser} -Ho ${endlessh_logfile} ${procname} -f ${endlessh_config} ${endlessh_args}'
run_rc_command $1
diff --git a/net/endlessh/files/endlessh.newsyslog.conf b/net/endlessh/files/endlessh.newsyslog.conf
new file mode 100644
index 000000000000..e50538e4dcf4
--- /dev/null
+++ b/net/endlessh/files/endlessh.newsyslog.conf
@@ -0,0 +1,11 @@
+# newsyslog configuration file for endlessh(1)
+#
+# Link (or copy) endlessh.newsyslog.conf to /usr/local/etc/newsyslog.conf.d/
+# to take care of log rotation.
+#
+# ln -s /usr/local/etc/endlessh.newsyslog.conf /usr/local/etc/newsyslog.conf.d
+#
+# See newsyslog.conf(5) for details.
+#
+# logfilename [owner:group] mode count size when flags [/pid_file] [sig_num]
+/var/log/endlessh.log root:wheel 600 7 * @T00 G /var/run/daemon_endlessh.pid SIGHUP
diff --git a/net/endlessh/pkg-message b/net/endlessh/files/pkg-message.in
index c34ff0613686..3dea43343029 100644
--- a/net/endlessh/pkg-message
+++ b/net/endlessh/files/pkg-message.in
@@ -11,11 +11,22 @@ To see the connections set LogLevel 1 in endlessh.conf or add "-v" to
endlessh_args. Sending SIGUSR1 to endlessh (pkill USR1 endlessh) will add
statistics to the /var/log/endlessh.log file
-Neither endlessh nor daemon support rotating the logfile, use periodic or
-cron to copy the logfile and truncate it using
+Link (or copy) endlessh.newsyslog.conf to ${PREFIX}/newsyslog.conf.d/
+to take care of log rotation.
- $ echo -n > /var/log/endlessh.log
+ln -s ${PREFIX}/etc/endlessh.newsyslog.conf $PREFIX}/etc/newsyslog.conf.d/
EOD
}
+,
+{
+ type: upgrade
+ message: <<EOD
+
+Link (or copy) endlessh.newsyslog.conf to %%PREFIX%%/newsyslog.conf.d/
+to take care of log rotation.
+
+ln -s %%PREFIX%%/etc/endlessh.newsyslog.conf %%PREFIX%%/etc/newsyslog.conf.d/
+
+EOD
]