summaryrefslogtreecommitdiffstats
path: root/Services/nodejs/sx
diff options
context:
space:
mode:
authorstartxfr <clarue@startx.fr>2014-12-08 02:35:03 +0100
committerstartxfr <clarue@startx.fr>2014-12-08 02:35:03 +0100
commitef2c1df934ee7720fd1ccacae042f3deb3b7628d (patch)
tree005eb1b5402f274f8643fa2d85ffa81da917a225 /Services/nodejs/sx
parenta7f649b8f1f56a999073550d1b91b5d8d1cd7d81 (diff)
downloadphpmyadmin-ef2c1df934ee7720fd1ccacae042f3deb3b7628d.tar.gz
phpmyadmin-ef2c1df934ee7720fd1ccacae042f3deb3b7628d.tar.bz2
phpmyadmin-ef2c1df934ee7720fd1ccacae042f3deb3b7628d.tar.xz
phpmyadmin-ef2c1df934ee7720fd1ccacae042f3deb3b7628d.zip
adding function and startup script for last services images : memcache, nodejs, ooconv and postresql
Diffstat (limited to 'Services/nodejs/sx')
-rw-r--r--Services/nodejs/sx/nodejs.sh40
-rw-r--r--Services/nodejs/sx/nodejs_run.sh7
2 files changed, 47 insertions, 0 deletions
diff --git a/Services/nodejs/sx/nodejs.sh b/Services/nodejs/sx/nodejs.sh
new file mode 100644
index 0000000..fcf3ebb
--- /dev/null
+++ b/Services/nodejs/sx/nodejs.sh
@@ -0,0 +1,40 @@
+#!/bin/bash
+export TERM=dumb
+
+# Begin configuration before starting daemonized process
+# and start generating host keys
+function begin_config {
+ echo "=> Begin nodejs configuration for host $HOSTNAME"
+}
+
+# End configuration process just before starting daemon
+function end_config {
+ echo "=> End nodejs configuration ..."
+}
+
+# Start the nodejs server in background. Used to perform config
+# against the database structure such as user creation
+function start_server {
+ echo "===> Starting nodejs server ..."
+ node $MAIN_APP &
+ sleep 4
+}
+
+# Stop the nodejs server running in background.
+function stop_server {
+ echo "===> Stopping nodejs server ..."
+ killall node
+ sleep 4
+}
+
+# Start the nodejs server as a deamon and execute it inside
+# the running shell
+function start_daemon {
+ echo "=> Starting nodejs daemon ..."
+ exec node $MAIN_APP
+}
+
+
+if [[ "$0" == *"nodejs.sh" && ! $1 = "" ]];then
+ eval "$@";
+fi \ No newline at end of file
diff --git a/Services/nodejs/sx/nodejs_run.sh b/Services/nodejs/sx/nodejs_run.sh
new file mode 100644
index 0000000..875dea2
--- /dev/null
+++ b/Services/nodejs/sx/nodejs_run.sh
@@ -0,0 +1,7 @@
+#!/bin/bash
+source /sx/nodejs.sh
+
+begin_config
+end_config
+
+start_daemon \ No newline at end of file