File tree Expand file tree Collapse file tree 2 files changed +21
-12
lines changed Expand file tree Collapse file tree 2 files changed +21
-12
lines changed Original file line number Diff line number Diff line change @@ -38,7 +38,12 @@ DAEMON=/usr/sbin/$NAME
38
38
39
39
if [ ` id -u` -ne 0 ]; then
40
40
echo " You need root privileges to run this script"
41
- exit 1
41
+ exit 4
42
+ fi
43
+
44
+ if [ ! -x $DAEMON ]; then
45
+ echo " Program not installed or not executable"
46
+ exit 5
42
47
fi
43
48
44
49
. /lib/lsb/init-functions
54
59
55
60
DAEMON_OPTS=" --pidfile=${PID_FILE} --config=${CONF_FILE} cfg:default.paths.data=${DATA_DIR} cfg:default.paths.logs=${LOG_DIR} "
56
61
57
- # Check DAEMON exists
58
- test -x $DAEMON || exit 0
59
-
60
62
case " $1 " in
61
63
start)
62
64
@@ -137,7 +139,7 @@ case "$1" in
137
139
;;
138
140
* )
139
141
log_success_msg " Usage: $0 {start|stop|restart|force-reload|status}"
140
- exit 1
142
+ exit 3
141
143
;;
142
144
esac
143
145
Original file line number Diff line number Diff line change @@ -35,6 +35,16 @@ MAX_OPEN_FILES=10000
35
35
PID_FILE=/var/run/$NAME .pid
36
36
DAEMON=/usr/sbin/$NAME
37
37
38
+ if [ ` id -u` -ne 0 ]; then
39
+ echo " You need root privileges to run this script"
40
+ exit 4
41
+ fi
42
+
43
+ if [ ! -x $DAEMON ]; then
44
+ echo " Program not installed or not executable"
45
+ exit 5
46
+ fi
47
+
38
48
#
39
49
# init.d / servicectl compatibility (openSUSE)
40
50
#
55
65
56
66
DAEMON_OPTS=" --pidfile=${PID_FILE} --config=${CONF_FILE} cfg:default.paths.data=${DATA_DIR} cfg:default.paths.logs=${LOG_DIR} "
57
67
58
- # Check DAEMON exists
59
- test -x $DAEMON || exit 0
60
-
61
68
function isRunning() {
62
69
status -p $PID_FILE $NAME > /dev/null 2>&1
63
70
}
@@ -69,7 +76,7 @@ case "$1" in
69
76
isRunning
70
77
if [ $? -eq 0 ]; then
71
78
echo " Already running."
72
- exit 2
79
+ exit 0
73
80
fi
74
81
75
82
# Prepare environment
@@ -90,7 +97,7 @@ case "$1" in
90
97
# check if pid file has been written two
91
98
if ! [[ -s $PID_FILE ]]; then
92
99
echo " FAILED"
93
- exit 3
100
+ exit 1
94
101
fi
95
102
i=0
96
103
timeout=10
@@ -101,7 +108,7 @@ case "$1" in
101
108
i=$(( $i + 1 ))
102
109
if [ $i -gt $timeout ]; then
103
110
echo " FAILED"
104
- exit 4
111
+ exit 1
105
112
fi
106
113
done
107
114
fi
@@ -141,6 +148,6 @@ case "$1" in
141
148
;;
142
149
* )
143
150
echo -n " Usage: $0 {start|stop|restart|force-reload|status}"
144
- exit 1
151
+ exit 3
145
152
;;
146
153
esac
You can’t perform that action at this time.
0 commit comments