forked from orientechnologies/orientdb
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathorientdb.sh
More file actions
73 lines (62 loc) · 1.37 KB
/
orientdb.sh
File metadata and controls
73 lines (62 loc) · 1.37 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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
#!/bin/sh
# OrientDB init script
# You have to SET the OrientDB installation directory here
ORIENTDB_DIR="YOUR_ORIENTDB_INSTALLATION_PATH"
ORIENTDB_USER="USER_YOU_WANT_ORIENTDB_RUN_WITH"
usage() {
echo "Usage: `basename $0`: <start|stop|status>"
exit 1
}
start() {
status
if [ $PID -gt 0 ]
then
echo "OrientDB server daemon was already started. PID: $PID"
return $PID
fi
echo "Starting OrientDB server daemon..."
cd "$ORIENTDB_DIR/bin"
su $ORIENTDB_USER -c "cd \"$ORIENTDB_DIR/bin\"; /usr/bin/nohup ./server.sh 1>../log/orientdb.log 2>../log/orientdb.err &"
}
stop() {
status
if [ $PID -eq 0 ]
then
echo "OrientDB server daemon is already not running"
return 0
fi
echo "Stopping OrientDB server daemon..."
cd "$ORIENTDB_DIR/bin"
su $ORIENTDB_USER -c "cd \"$ORIENTDB_DIR/bin\"; /usr/bin/nohup ./shutdown.sh 1>>../log/orientdb.log 2>>../log/orientdb.err &"
}
status() {
PID=`ps -ef | grep 'orientdb.www.path' | grep java | grep -v grep | awk '{print $2}'`
if [ "x$PID" = "x" ]
then
PID=0
fi
# if PID is greater than 0 then OrientDB is running, else it is not
return $PID
}
if [ "x$1" = "xstart" ]
then
start
exit 0
fi
if [ "x$1" = "xstop" ]
then
stop
exit 0
fi
if [ "x$1" = "xstatus" ]
then
status
if [ $PID -gt 0 ]
then
echo "OrientDB server daemon is running with PID: $PID"
else
echo "OrientDB server daemon is NOT running"
fi
exit $PID
fi
usage