source: other-projects/bib-stinky/trunk/nodejs-server/bibstinky-start-server.sh@ 36315

Last change on this file since 36315 was 36315, checked in by davidb, 21 months ago

Utility scripts for starting and stopping the Express-based web server that will ultimately provideBib-Stinky functionality; imprinted of files developed for the Hey You Interact with Me project

  • Property svn:executable set to *
File size: 1.2 KB
Line 
1#!/bin/bash
2
3# Work out where we are on the filesystem:
4# https://stackoverflow.com/questions/59895/how-can-i-get-the-source-directory-of-a-bash-script-from-within-the-script-itsel
5
6BIBSTINKY_HOME=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
7
8
9cd "$BIBSTINKY_HOME" \
10 && . ./bibstinky-setup.bash
11
12if [ $? = "0" ] ; then
13 echo ""
14 echo "Launching node activity-launcher as a background process"
15 echo ""
16 echo "Logging output to:"
17 echo " $PWD/bibstinky-server.log"
18 echo ""
19
20 echo "Initializing ..."
21
22 node express-web-server.js </dev/null >bibstinky-server.log 2>&1 &
23 bibstinky_server_pid=$!
24
25 # Give the server a bit of time to start up in the background
26 sleep 2
27
28 if [ -d /proc/$bibstinky_server_pid ] ; then
29 echo " ... successfully initialized"
30 echo $bibstinky_server_pid >bibstinky-server.pid
31 else
32 echo "" >&2
33 echo "Error encountered running: $0" >&2
34 echo "" >&2
35
36 echo "... failed to initialize initialization"
37 echo ""
38 echo "For further details see:"
39 echo " bibstinky-server.log"
40 echo ""
41 fi
42
43else
44 echo "Failed to successfully source 'bibstinky-setup.bash'" >&2
45fi
Note: See TracBrowser for help on using the repository browser.