Magellan Linux

Annotation of /mcore-src/trunk/mcore-tools/src/modules/sysvinit/sysvinit.client.class.in

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2243 - (hide annotations) (download)
Mon Jan 13 09:27:41 2014 UTC (10 years, 4 months ago) by niro
File size: 1550 byte(s)
-fixed spelling - unkown -> unknown
1 niro 2079 # $Id$
2    
3     provide basic-init sysvinit
4     require basic-system
5    
6     set_system_service()
7     {
8     local command="$1"
9     local service="$2"
10     local opts="$3"
11    
12     [[ -z ${command} ]] && help_system_service && return 1
13     [[ -z ${service} ]] && help_system_service && return 1
14    
15 niro 2168 if [[ ! -x ${MROOT}@@SYSVRCDDIR@@/${service} ]]
16 niro 2079 then
17 niro 2243 eecho "Service '${service}' unknown!"
18 niro 2079 return 1
19     fi
20    
21 niro 2088 if [[ -n ${MROOT} ]] && [[ ${MROOT} != / ]]
22     then
23     case "${command}" in
24     start|stop|restart|reload)
25     eecho "Command not available while \$MROOT is set"
26     return 1
27     ;;
28     esac
29     fi
30    
31 niro 2079 case "${command}" in
32 niro 2168 start) @@SYSVRCDDIR@@/"${service}" start ;;
33     stop) @@SYSVRCDDIR@@/"${service}" stop ;;
34     restart) @@SYSVRCDDIR@@/"${service}" restart ;;
35     reload) @@SYSVRCDDIR@@/"${service}" reload ;;
36 niro 2090 enable) rc-config add "${service}" ;;
37     disable) rc-config del "${service}" ;;
38 niro 2079 *) help_system_service && return ;;
39     esac
40     }
41    
42     get_system_service()
43     {
44     local command="$1"
45     local service="$2"
46    
47     [[ -z ${command} ]] && help_system_service && return 1
48     [[ -z ${service} ]] && help_system_service && return 1
49    
50 niro 2168 if [[ ! -x ${MROOT}@@SYSVRCDDIR@@/${service} ]]
51 niro 2079 then
52 niro 2243 eecho "Service '${service}' unknown!"
53 niro 2079 return 1
54     fi
55    
56 niro 2088 if [[ -n ${MROOT} ]] && [[ ${MROOT} != / ]]
57     then
58     case "${command}" in
59     status)
60     eecho "Command not available while \$MROOT is set"
61     return 1
62     ;;
63     esac
64     fi
65    
66 niro 2079 case "${command}" in
67 niro 2168 status) @@SYSVRCDDIR@@/"${service}" status ;;
68 niro 2079 enabled) rc-config show "${service}" ;;
69     runlevel) eecho "function on todo" ;;
70     *) help_system_service && return ;;
71     esac
72     }