5 |
|
|
6 |
set_system_service() |
set_system_service() |
7 |
{ |
{ |
8 |
local command="$1" |
local command="${CLASS_ARGV[0]}" |
9 |
local service="$2" |
local service="${CLASS_ARGV[1]}" |
10 |
local opts="$3" |
local opts="${CLASS_ARGV[2]}" |
11 |
|
|
12 |
[[ -z ${command} ]] && help_system_service && return 1 |
[[ -z ${command} ]] && help_system_service && return 1 |
13 |
[[ -z ${service} ]] && help_system_service && return 1 |
[[ -z ${service} ]] && help_system_service && return 1 |
14 |
|
|
|
if [[ ! -x ${MROOT}/etc/rc.d/init.d/${service} ]] |
|
|
then |
|
|
eecho "Service '${service}' unkown!" |
|
|
return 1 |
|
|
fi |
|
|
|
|
|
if [[ -n ${MROOT} ]] && [[ ${MROOT} != / ]] |
|
|
then |
|
|
case "${command}" in |
|
|
start|stop|restart|reload) |
|
|
eecho "Command not available while \$MROOT is set" |
|
|
return 1 |
|
|
;; |
|
|
esac |
|
|
fi |
|
|
|
|
15 |
case "${command}" in |
case "${command}" in |
16 |
start) /etc/rc.d/init.d/"${service}" start ;; |
start) mcore-system-service start "${service}" ;; |
17 |
stop) /etc/rc.d/init.d/"${service}" stop ;; |
stop) mcore-system-service stop "${service}" ;; |
18 |
restart) /etc/rc.d/init.d/"${service}" restart ;; |
restart) mcore-system-service restart "${service}" ;; |
19 |
reload) /etc/rc.d/init.d/"${service}" reload ;; |
reload) mcore-system-service reload "${service}" ;; |
20 |
enable) rc-config add "${service}" ;; |
enable) mcore-system-service enable "${service}" ;; |
21 |
disable) rc-config del "${service}" ;; |
disable) mcore-system-service disable "${service}" ;; |
22 |
*) help_system_service && return ;; |
*) help_system_service && return 1 ;; |
23 |
esac |
esac |
24 |
} |
} |
25 |
|
|
26 |
get_system_service() |
get_system_service() |
27 |
{ |
{ |
28 |
local command="$1" |
local command="${CLASS_ARGV[0]}" |
29 |
local service="$2" |
local service="${CLASS_ARGV[1]}" |
30 |
|
|
31 |
[[ -z ${command} ]] && help_system_service && return 1 |
[[ -z ${command} ]] && help_system_service && return 1 |
32 |
[[ -z ${service} ]] && help_system_service && return 1 |
[[ -z ${service} ]] && help_system_service && return 1 |
33 |
|
|
|
if [[ ! -x ${MROOT}/etc/rc.d/init.d/${service} ]] |
|
|
then |
|
|
eecho "Service '${service}' unkown!" |
|
|
return 1 |
|
|
fi |
|
|
|
|
|
if [[ -n ${MROOT} ]] && [[ ${MROOT} != / ]] |
|
|
then |
|
|
case "${command}" in |
|
|
status) |
|
|
eecho "Command not available while \$MROOT is set" |
|
|
return 1 |
|
|
;; |
|
|
esac |
|
|
fi |
|
|
|
|
34 |
case "${command}" in |
case "${command}" in |
35 |
status) /etc/rc.d/init.d/"${service}" status ;; |
status) mcore-system-service status "${service}" status ;; |
36 |
enabled) rc-config show "${service}" ;; |
enabled) mcore-system-service enabled "${service}" ;; |
37 |
runlevel) eecho "function on todo" ;; |
runlevel) mcore-system-service runlevel ;; |
38 |
*) help_system_service && return ;; |
*) help_system_service && return 1 ;; |
39 |
esac |
esac |
40 |
} |
} |