forked from Be-Secure/BeSLighthouse
-
Notifications
You must be signed in to change notification settings - Fork 0
/
beslighthouse.sh
42 lines (36 loc) · 848 Bytes
/
beslighthouse.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
#!/bin/bash
start() {
if [ -d "$HOME/.besman" ];then
beslighthousedatafile="$HOME/.besman/beslighthousedata"
elif [ -d "$HOME/.bliman" ];then
beslighthousedatafile="$HOME/.bliman/beslighthousedata"
fi
if [ ! -z $beslighthousedatafile ] && [ -f $beslighthousedatafile ];then
lightdir=`cat $beslighthousedatafile | grep "BESLIGHTHOUSE_DIR:" | awk '{print $2}'`
cd $lightdir
npm start &
fi
}
stop() {
pid=`ps ax | grep "npm start" | awk '{print $1}'`
kill -9 $pid
}
case "$1" in
start)
start
;;
stop)
stop
;;
restart)
stop
start
;;
status)
# code to check status of app comes here
# example: status program_name
;;
*)
echo "Usage: $0 {start|stop|status|restart}"
esac
exit 0