Contents of /mcore-src/trunk/mcore-tools/src/modules/systemd/systemd.client.class.in
Parent Directory | Revision Log
Revision 2648 -
(show annotations)
(download)
Tue Nov 10 14:41:19 2015 UTC (8 years, 10 months ago) by niro
File size: 1116 byte(s)
Tue Nov 10 14:41:19 2015 UTC (8 years, 10 months ago) by niro
File size: 1116 byte(s)
-use a helper script to control system services and to be able to control services with other modules
1 | # $Id$ |
2 | |
3 | provide basic-init systemd |
4 | require basic-system |
5 | |
6 | set_system_service() |
7 | { |
8 | local command="${CLASS_ARGV[0]}" |
9 | local service="${CLASS_ARGV[1]}" |
10 | local opts="${CLASS_ARGV[2]}" |
11 | |
12 | [[ -z ${command} ]] && help_system_service && return 1 |
13 | [[ -z ${service} ]] && help_system_service && return 1 |
14 | |
15 | case "${command}" in |
16 | start) mcore-system-service start "${service}" ;; |
17 | stop) mcore-system-service stop "${service}" ;; |
18 | restart) mcore-system-service restart "${service}" ;; |
19 | reload) mcore-system-service reload "${service}" ;; |
20 | enable) mcore-system-service enable "${service}" ;; |
21 | disable) mcore-system-service disable "${service}" ;; |
22 | *) help_system_service && return 1 ;; |
23 | esac |
24 | } |
25 | |
26 | get_system_service() |
27 | { |
28 | local command="${CLASS_ARGV[0]}" |
29 | local service="${CLASS_ARGV[1]}" |
30 | |
31 | [[ -z ${command} ]] && help_system_service && return 1 |
32 | [[ -z ${service} ]] && help_system_service && return 1 |
33 | |
34 | case "${command}" in |
35 | status) mcore-system-service status "${service}" ;; |
36 | enabled) mcore-system-service enabled "${service}" ;; |
37 | runlevel) mcore-system-service runlevel ;; |
38 | *) help_system_service && return 1 ;; |
39 | esac |
40 | } |