summaryrefslogtreecommitdiff
path: root/databases/mongodb/files/mongodb.sh
diff options
context:
space:
mode:
Diffstat (limited to 'databases/mongodb/files/mongodb.sh')
-rw-r--r--databases/mongodb/files/mongodb.sh37
1 files changed, 37 insertions, 0 deletions
diff --git a/databases/mongodb/files/mongodb.sh b/databases/mongodb/files/mongodb.sh
new file mode 100644
index 00000000000..e7ac2eafb17
--- /dev/null
+++ b/databases/mongodb/files/mongodb.sh
@@ -0,0 +1,37 @@
+#!@RCD_SCRIPTS_SHELL@
+#
+# $NetBSD: mongodb.sh,v 1.1 2015/05/02 08:10:33 ryoon Exp $
+#
+# PROVIDE: mongodb
+# REQUIRE: DAEMON LOGIN mountall
+# KEYWORD: shutdown
+#
+# You will need to set some variables in /etc/rc.conf to start MongoDB:
+#
+# mongodb=YES
+#
+# The following variables are optional:
+#
+# mongodb_user="@MONGODB_USER@" # user to run mongod as
+# mongodb_group="@MONGODB_GROUP@" # group to run mongod as
+# mongodb_dbpath="@MONGODB_DBPATH@" # path to MongoDB database directory
+#
+
+if [ -f /etc/rc.subr ]; then
+ . /etc/rc.subr
+fi
+
+name="mongodb"
+rcvar=${name}
+command="@PREFIX@/bin/mongod"
+: ${mongodb_user:=@MONGODB_USER@}
+: ${mongodb_group:=@MONGODB_GROUP@}
+: ${mongodb_dbpath:=@MONGODB_DBPATH@}
+pidfile="${mongodb_dbpath}/mongod.pid"
+logfile="${mongodb_dbpath}/mongod.log"
+required_dirs="${mongodb_dbpath}"
+
+command_args="--fork --logpath ${logfile} --logappend --pidfilepath ${pidfile} --dbpath ${mongodb_dbpath} --smallfiles"
+
+load_rc_config ${name}
+run_rc_command "$1"