This repository was archived by the owner on Mar 16, 2026. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathnode-express
More file actions
executable file
·58 lines (52 loc) · 1.57 KB
/
node-express
File metadata and controls
executable file
·58 lines (52 loc) · 1.57 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
#!/bin/bash
#" Remember to set the project durectory: "
#project=/home/tore/Arbeten/mish
project=/home/tore/Arbeten/mish-dev
port=3000
prid=`lsof -t -i:$port`
# If in autostart, this port shouldn't be occupied
if [[ $prid ]]; then
echo "Port $port is occupied by a process with pid=$prid;"
# Else, maybe kill the process listening to this port
echo -n "Kill the process and continue? (y/N): "
read yN
if [[ $yN != 'y' && $yN != 'yes' ]]; then
echo "Cancelled"
exit
fi
sudo kill $prid
clear
fi
# Make the script usable from any directory
cd $project
echo pwd is $project
#IMDB_HOME=/mnt/sda2
#IMDB_HOME=/mnt/koofrwebdav
IMDB_HOME=/home/tore
#IMDB_ROOT=MISH
IMDB_ROOT=Album-1
IMDB_ROOT='""'
### NOTE: IMDB_ROOT may be empty in order to force the user to choose
### among album collections. Such an 'empty' string argument must be '""'
### in order to be passed correctly positioned into `node server.js ...`,
### since '' or "" will cause errors. The '""' parameter will be taken
### care of and is eventually converted into an empty string.
if [[ $1 ]]; then
IMDB_HOME=$1
if [[ $2 ]]; then
IMDB_ROOT=$2
fi
fi
echo IMDB_HOME = $IMDB_HOME
if [[ $IMDB_ROOT != '""' ]]; then
echo IMDB_ROOT = $IMDB_ROOT
else
echo "IMDB_ROOT = [user choice]"
fi
echo -n "##### Starting the Node server "`date`
# Note that Node JS may be installed as either 'node', 'nodejs', or both
# Start the Express server. NOTE: server.js contains `import express from 'express'`
logger "EXPRESS starting"
logger `echo $PATH`
logger `whereis node`
/usr/bin/node server.js $IMDB_HOME $IMDB_ROOT $port