pkgsrc-WIP-changes archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

nats-server: Fix NetBSD startup script.



Module Name:	pkgsrc-wip
Committed By:	Juraj Lutter <otis%NetBSD.org@localhost>
Pushed By:	otis
Date:		Tue Oct 13 00:19:47 2020 +0200
Changeset:	8cfe331cd1a99e9bccde6f2be093d3cc0e2d38de

Modified Files:
	nats-server/files/nats-server.sh

Log Message:
nats-server: Fix NetBSD startup script.

To see a diff of this commit:
https://wip.pkgsrc.org/cgi-bin/gitweb.cgi?p=pkgsrc-wip.git;a=commitdiff;h=8cfe331cd1a99e9bccde6f2be093d3cc0e2d38de

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

diffstat:
 nats-server/files/nats-server.sh | 22 ++++++++++++++++------
 1 file changed, 16 insertions(+), 6 deletions(-)

diffs:
diff --git a/nats-server/files/nats-server.sh b/nats-server/files/nats-server.sh
index e41da3c114..6a7755cd51 100644
--- a/nats-server/files/nats-server.sh
+++ b/nats-server/files/nats-server.sh
@@ -34,6 +34,7 @@ command="@PREFIX@/bin/nats-server"
 : ${natsserver_group:="natssrv"}
 
 start_cmd="natssrv_start"
+stop_cmd="natssrv_stop"
 
 natssrv_start()
 {
@@ -41,8 +42,20 @@ natssrv_start()
 	ulimit -n 4096
 	cd @NATS_HOMEDIR@
 	/usr/bin/su ${natsserver_user}:${natsserver_group} \
-	   ${command} -P ${natsserver_pidfile} \
-	   -l ${natsserver_logfile} &
+	   -c "${command} -P ${natsserver_pidfile} \
+	   -l ${natsserver_logfile} &"
+}
+
+natssrv_stop()
+{
+	local pidfile
+
+	pidfile="${natsserver_pidfile}"
+	if [ -r "${pidfile}" ]; then
+		echo "Stopping ${name}."
+		kill `/bin/cat ${pidfile}`
+		/bin/rm "${pidfile}"
+	fi
 }
 
 if [ -f /etc/rc.subr -a -d /etc/rc.d -a -f /etc/rc.d/DAEMON ]; then
@@ -56,10 +69,7 @@ else
 	pidfile="${natsserver_pidfile}"
 	case "$1" in
 	stop)
-		if [ -r "${pidfile}" ]; then
-			@ECHO@ "Stopping ${name}."
-			kill `@CAT@ ${pidfile}`
-		fi
+		natssrv_stop
 		;;
 	*)
 		eval ${start_cmd}


Home | Main Index | Thread Index | Old Index