pkgsrc-WIP-changes archive

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

nats-server: Normalize nats-server rc.d script



Module Name:	pkgsrc-wip
Committed By:	Juraj Lutter <otis%NetBSD.org@localhost>
Pushed By:	otis
Date:		Wed Oct 14 22:23:45 2020 +0200
Changeset:	a7dd54e2de99763e2419a0a78d2690d6776dea70

Modified Files:
	nats-server/Makefile
Added Files:
	nats-server/files/nats_server.sh
Removed Files:
	nats-server/files/nats-server.sh

Log Message:
nats-server: Normalize nats-server rc.d script

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

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

diffstat:
 nats-server/Makefile             |  4 +--
 nats-server/files/nats-server.sh | 78 ----------------------------------------
 nats-server/files/nats_server.sh | 78 ++++++++++++++++++++++++++++++++++++++++
 3 files changed, 80 insertions(+), 80 deletions(-)

diffs:
diff --git a/nats-server/Makefile b/nats-server/Makefile
index 3032caee45..a8bed6c9ea 100644
--- a/nats-server/Makefile
+++ b/nats-server/Makefile
@@ -31,9 +31,9 @@ PKG_HOME.${NATS_USER}=		${NATS_HOMEDIR}
 PKG_GECOS.${NATS_USER}=		nats.io server
 PKG_SHELL.${NATS_USER}=		/bin/sh
 
-RCD_SCRIPTS=            nats-server
+RCD_SCRIPTS=            nats_server
 SMF_NAME=               nats-server
-SMF_METHODS=            ${RCD_SCRIPTS}
+SMF_METHODS=            nats-server
 
 FILES_SUBST+=		NATS_USER=${NATS_USER}
 FILES_SUBST+=		NATS_GROUP=${NATS_GROUP}
diff --git a/nats-server/files/nats-server.sh b/nats-server/files/nats-server.sh
deleted file mode 100644
index 6a7755cd51..0000000000
--- a/nats-server/files/nats-server.sh
+++ /dev/null
@@ -1,78 +0,0 @@
-#!@RCD_SCRIPTS_SHELL@
-#
-# $NetBSD$
-#
-# PROVIDE: nats-server
-# REQUIRE: DAEMON LOGIN mountall
-# KEYWORD: shutdown
-#
-# You will need to set some variables in /etc/rc.conf to start nats-server:
-#
-# natsserver=YES
-#
-# The following variables are optional:
-#
-# natsserver_pidfile="/path/to/p.pid"	path to nats-server PID file
-#					default:
-#					@NATS_HOMEDIR@/nats-server.pid
-# natsserver_logfile="/path/to/p.log"	path to nats-server log file
-#					default:
-#					@NATS_LOGFILE@
-# natsserver_user="natssrv"		the username for nats-server daemon
-# natsserver_group="natssrv"		the group for nats-server daemon
-
-if [ -f /etc/rc.subr ]; then
-	. /etc/rc.subr
-fi
-
-name="nats-server"
-rcvar="natsserver"
-command="@PREFIX@/bin/nats-server"
-: ${natsserver_pidfile:="@NATS_HOMEDIR@/nats-server.pid"}
-: ${natsserver_logfile:="@NATS_LOGFILE@"}
-: ${natsserver_user:="natssrv"}
-: ${natsserver_group:="natssrv"}
-
-start_cmd="natssrv_start"
-stop_cmd="natssrv_stop"
-
-natssrv_start()
-{
-	@ECHO@ "Starting ${name}."
-	ulimit -n 4096
-	cd @NATS_HOMEDIR@
-	/usr/bin/su ${natsserver_user}:${natsserver_group} \
-	   -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
-	load_rc_config $name
-	pidfile="${natsserver_pidfile}"
-	run_rc_command "$1"
-else
-	if [ -f /etc/rc.conf ]; then
-		. /etc/rc.conf
-	fi
-	pidfile="${natsserver_pidfile}"
-	case "$1" in
-	stop)
-		natssrv_stop
-		;;
-	*)
-		eval ${start_cmd}
-		;;
-	esac
-fi
diff --git a/nats-server/files/nats_server.sh b/nats-server/files/nats_server.sh
new file mode 100644
index 0000000000..29c847413e
--- /dev/null
+++ b/nats-server/files/nats_server.sh
@@ -0,0 +1,78 @@
+#!@RCD_SCRIPTS_SHELL@
+#
+# $NetBSD$
+#
+# PROVIDE: nats_server
+# REQUIRE: DAEMON LOGIN mountall
+# KEYWORD: shutdown
+#
+# You will need to set some variables in /etc/rc.conf to start nats-server:
+#
+# nats_server=YES
+#
+# The following variables are optional:
+#
+# nats_server_pidfile="/path/to/p.pid"	path to nats-server PID file
+#					default:
+#					@NATS_HOMEDIR@/nats-server.pid
+# nats_server_logfile="/path/to/p.log"	path to nats-server log file
+#					default:
+#					@NATS_LOGFILE@
+# nats_server_user="natssrv"		the username for nats-server daemon
+# nats_server_group="natssrv"		the group for nats-server daemon
+
+if [ -f /etc/rc.subr ]; then
+	. /etc/rc.subr
+fi
+
+name="nats_server"
+rcvar="nats_server"
+command="@PREFIX@/bin/nats-server"
+: ${nats_server_pidfile:="@NATS_HOMEDIR@/nats-server.pid"}
+: ${nats_server_logfile:="@NATS_LOGFILE@"}
+: ${nats_server_user:="natssrv"}
+: ${nats_server_group:="natssrv"}
+
+start_cmd="natssrv_start"
+stop_cmd="natssrv_stop"
+
+natssrv_start()
+{
+	@ECHO@ "Starting ${name}."
+	ulimit -n 4096
+	cd @NATS_HOMEDIR@
+	/usr/bin/su ${nats_server_user}:${nats_server_group} \
+	   -c "${command} -P ${nats_server_pidfile} \
+	   -l ${nats_server_logfile} &"
+}
+
+natssrv_stop()
+{
+	local pidfile
+
+	pidfile="${nats_server_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
+	load_rc_config $name
+	pidfile="${nats_server_pidfile}"
+	run_rc_command "$1"
+else
+	if [ -f /etc/rc.conf ]; then
+		. /etc/rc.conf
+	fi
+	pidfile="${nats_server_pidfile}"
+	case "$1" in
+	stop)
+		natssrv_stop
+		;;
+	*)
+		eval ${start_cmd}
+		;;
+	esac
+fi


Home | Main Index | Thread Index | Old Index