-
Notifications
You must be signed in to change notification settings - Fork 23
/
Copy pathneji
53 lines (48 loc) · 1010 Bytes
/
neji
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
#!/bin/bash
# USAGE: start|stop|status|logs
#
export JAVA_HOME=/usr/lib/jvm/java-7-oracle
TOOL='Neji Web Server'
DIR=/opt/neji
PIDFILE=$DIR/RUNNING_PID
PORT=8010
THREADS=1
USER=root
GROUP=root
case "$1" in
start)
if [ -f "${PIDFILE}" ]; then
echo "$TOOL is already running."
else
START_CMD="./nejiWeb.sh -port $PORT -t $THREADS"
sudo start-stop-daemon --start -p "${PIDFILE}" -d "${DIR}" --quiet --background --chuid ${USER}:${GROUP} --exec /bin/bash -- ${START_CMD}
echo "$TOOL is running."
fi
;;
stop)
if [ -f "${PIDFILE}" ]; then
sudo start-stop-daemon -K -p "${PIDFILE}" -u "${USER}" -R 30
sudo rm $PIDFILE
echo "$TOOL is stopped."
else
echo "$TOOL is not running."
fi
;;
logs)
echo "See the logs of the $TOOL."
tail -f $DIR/logs/gimli.log &
;;
status)
# Check to see if the process is running
if [ -f "${PIDFILE}" ]; then
echo "$TOOL is running."
else
echo "$TOOL is stopped."
fi
;;
*)
echo “$TOOL Service”
echo $”Usage: $0 {start|stop|status|logs}”
exit 1
esac
exit 0