-
Notifications
You must be signed in to change notification settings - Fork 20
/
Copy pathapi.sh
executable file
·51 lines (48 loc) · 1.27 KB
/
api.sh
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
#!/bin/bash
#------------------------------------------------------------------------------
# Script to start/stop Mojolicious development web server (morbo) for this sandbox.
#------------------------------------------------------------------------------
start() {
export COGE_HOME=$(pwd)
export PERL5LIB=$COGE_HOME/modules/perl
export IRODSENV=$COGE_HOME/irodsEnv_local
# hypnotoad -f ./web/services/api.pl >> ./api.log 2>&1 &
# ./web/services/api.pl daemon -l http://localhost:3304 >> ./api.log 2>&1 &
port=$(grep MOJOLICIOUS_PORT ./coge.conf | cut -d ' ' -f 2)
if [ "$port" == "" ]; then
port=3303
fi
morbo -w $PERL5LIB -l http://localhost:$port ./web/services/api.pl >> $HOME/api.log 2>&1 &
echo "Started API (port $port)"
}
stop() {
# hypnotoad ./web/services/api.pl --stop
me=$(whoami)
pid=$(pgrep -u $me 'morbo')
if [ "$pid" != "" ]; then
kill -9 $pid
echo "Stopped API (pid $pid)"
else
echo "Not running"
fi
}
case "$1" in
start)
start
exit 0
;;
stop)
stop
exit 0
;;
restart)
stop
sleep 1
start
exit 0
;;
*)
echo "Usage: $0 {start|stop|restart}" 1>&2
exit 1
;;
esac