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
74
75
76
77
78
79
|
Index: sbin/rc-daemon.sh
===================================================================
--- sbin/rc-daemon.sh (revision 2473)
+++ sbin/rc-daemon.sh (working copy)
@@ -325,7 +325,7 @@
# If not, we stop the service
update_service_status() {
local service="$1" daemonfile="${svcdir}/daemons/$1" i
- local -a RC_DAEMONS=() RC_PIDFILES=()
+ local -a RC_DAEMONS=() RC_PIDFILES=() RC_NAMES=()
# We only care about marking started services as stopped if the daemon(s)
# for it are no longer running
@@ -354,7 +354,7 @@
local args="$( requote "$@" )" result i
local cmd name pidfile pid stopping signal nothing=false
local daemonfile=
- local -a RC_DAEMONS=() RC_PIDFILES=()
+ local -a RC_DAEMONS=() RC_PIDFILES=() RC_NAMES=()
if [[ -n ${SVCNAME} ]] ; then
daemonfile="${svcdir}/daemons/${SVCNAME}"
@@ -380,9 +380,10 @@
# But most called to --stop only set the pidfile
if [[ ${RC_DAEMONS[i]} == "{cmd}" \
|| ${RC_PIDFILES[i]} == "${pidfile}" ]]; then
- unset RC_DAEMONS[i] RC_PIDFILES[i]
+ unset RC_DAEMONS[i] RC_PIDFILES[i] RC_NAMES[i]
RC_DAEMONS=( "${RC_DAEMONS[@]}" )
RC_PIDFILES=( "${RC_PIDFILES[@]}" )
+ RC_NAMES=( "${RC_NAMES[@]}" )
break
fi
done
@@ -404,6 +405,7 @@
if [[ ${i} == "${max}" ]]; then
RC_DAEMONS[max]="${cmd}"
RC_PIDFILES[max]="${pidfile}"
+ RC_NAMES[max]="${name}"
fi
fi
fi
@@ -412,12 +414,14 @@
if [[ ${#RC_DAEMONS[@]} == "0" ]]; then
[[ -f ${daemonfile} ]] && rm -f "${daemonfile}"
elif [[ -n ${daemonfile} ]] ; then
- echo "RC_DAEMONS[0]=\"${RC_DAEMONS[0]}\"" > "${daemonfile}"
- echo "RC_PIDFILES[0]=\"${RC_PIDFILES[0]}\"" >> "${daemonfile}"
+ echo "RC_DAEMONS[0]='${RC_DAEMONS[0]}'" > "${daemonfile}"
+ echo "RC_PIDFILES[0]='${RC_PIDFILES[0]}'" >> "${daemonfile}"
+ echo "RC_NAMES[0]='${RC_NAMES[0]}'" >> "${daemonfile}"
for (( i=1; i<${#RC_DAEMONS[@]}; i++ )); do
- echo "RC_DAEMONS[${i}]=\"${RC_DAEMONS[i]}\"" >> "${daemonfile}"
- echo "RC_PIDFILES[${i}]=\"${RC_PIDFILES[i]}\"" >> "${daemonfile}"
+ echo "RC_DAEMONS[${i}]='${RC_DAEMONS[i]}'" >> "${daemonfile}"
+ echo "RC_PIDFILES[${i}]='${RC_PIDFILES[i]}'" >> "${daemonfile}"
+ echo "RC_NAMES[${i}]='${RC_NAMES[i]}'" >> "${daemonfile}"
done
fi
Index: sbin/rc-services.sh
===================================================================
--- sbin/rc-services.sh (revision 2483)
+++ sbin/rc-services.sh (working copy)
@@ -707,11 +707,11 @@
# If index is emtpy, then we don't care what the first daemon launched
# was, otherwise the daemon must also be at that index
service_started_daemon() {
- local service="$1" daemon="$2" index="${3:-[0-9]*}"
+ local service="$1" daemon="'$2'" index="${3:-[0-9]*}"
local daemonfile="${svcdir}/daemons/${service}"
[[ ! -e ${daemonfile} ]] && return 1
- grep -q '^RC_DAEMONS\['"${index}"'\]="'${daemon}'"$' "${daemonfile}"
+ grep -q '^RC_DAEMONS\['"${index}"'\]='"${daemon}"'$' "${daemonfile}"
}
# bool net_service(service)
|