forked from bolidozor/js9
-
Notifications
You must be signed in to change notification settings - Fork 0
/
nnode
executable file
·54 lines (47 loc) · 1012 Bytes
/
nnode
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
#!/bin/sh
# defaults
DEFPREFS="js9Prefs.json"
HELPER="./js9Helper.js"
LOG="./node.log"
# process command line switches
while [ x"$1" != x ]; do
case $1 in
-h) HELPER="$2"
shift
shift
if [ ! -r "$HELPER" ]; then
echo "ERROR: can't find prefs file: $HELPER"
exit 1
fi
;;
-l) LOG="$2"
shift
shift
;;
-p) PREFS="$2"
shift
shift
if [ -r "$PREFS" ]; then
if [ -f $DEFPREFS ]; then
X=`diff -q $DEFPREFS $PREFS`
if [ x"$X" != x ]; then
mv $DEFPREFS $DEFPREFS-prev
ln -s $PREFS $DEFPREFS
fi
else
ln -s $PREFS $DEFPREFS
fi
PSTR="with prefs file $PREFS"
else
echo "ERROR: can't find prefs file: $PREFS"
exit 1
fi
;;
*) echo "ERROR: unknown argument: $1"
exit 1
;;
esac
done
killp js9Helper.js >& /dev/null
echo "starting node $HELPER $PSTR"
node $HELPER 2>&1 > $LOG &