diff options
author | startxfr <clarue@startx.fr> | 2014-12-06 02:51:42 +0100 |
---|---|---|
committer | startxfr <clarue@startx.fr> | 2014-12-06 02:51:42 +0100 |
commit | a7f649b8f1f56a999073550d1b91b5d8d1cd7d81 (patch) | |
tree | c7739a5c22615c3d3ca5bb59821a598e40460f02 /Services/mongo/sx | |
parent | 076db03abf9ac12a057b784a3e0999180ca53543 (diff) | |
download | phpmyadmin-a7f649b8f1f56a999073550d1b91b5d8d1cd7d81.tar.gz phpmyadmin-a7f649b8f1f56a999073550d1b91b5d8d1cd7d81.tar.bz2 phpmyadmin-a7f649b8f1f56a999073550d1b91b5d8d1cd7d81.tar.xz phpmyadmin-a7f649b8f1f56a999073550d1b91b5d8d1cd7d81.zip |
adding functionnal mongodb server
Diffstat (limited to 'Services/mongo/sx')
-rw-r--r-- | Services/mongo/sx/mongod.sh | 48 | ||||
-rw-r--r-- | Services/mongo/sx/mongod_run.sh | 7 |
2 files changed, 55 insertions, 0 deletions
diff --git a/Services/mongo/sx/mongod.sh b/Services/mongo/sx/mongod.sh new file mode 100644 index 0000000..9bb6281 --- /dev/null +++ b/Services/mongo/sx/mongod.sh @@ -0,0 +1,48 @@ +#!/bin/bash + +export TERM=dumb +export MONGO_CONF=/etc/mongodb.conf +export MONGO_LOGDIR=/var/log/mongodb +export MONGO_DATADIR=/var/lib/mongodb + + +# Begin configuration before starting daemonized process +# and start generating host keys +function begin_config { + echo "=> Begin mongod configuration for host $HOSTNAME" + mkdir -p $MONGO_LOGDIR + mkdir -p $MONGO_DATADIR +} + +# End configuration process just before starting daemon +function end_config { + stop_server + echo "=> End mongod configuration ..." +} + +# Start the mongod server in background. Used to perform config +# against the database structure such as user creation +function start_server { + echo "===> Starting mongod server ..." + /usr/bin/mongod --config $MONGO_CONF & + sleep 8 +} + +# Stop the mongod server running in background. +function stop_server { + echo "===> Stopping mongod server ..." + /usr/bin/mongod --shutdown; sleep 2 + killall mongod; sleep 6 +} + +# Start the mongod server as a deamon and execute it inside +# the running shell +function start_daemon { + echo "=> Starting mongod daemon ..." + exec /usr/bin/mongod --config $MONGO_CONF --quiet run +} + + +if [[ "$0" == *"mongod.sh" && ! $1 = "" ]];then + eval "$@"; +fi
\ No newline at end of file diff --git a/Services/mongo/sx/mongod_run.sh b/Services/mongo/sx/mongod_run.sh new file mode 100644 index 0000000..6a0f018 --- /dev/null +++ b/Services/mongo/sx/mongod_run.sh @@ -0,0 +1,7 @@ +#!/bin/bash +source /sx/mongod.sh + +begin_config +end_config + +start_daemon
\ No newline at end of file |