Magellan Linux

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2648 - (hide annotations) (download)
Tue Nov 10 14:41:19 2015 UTC (8 years, 6 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 niro 2079 # $Id$
2    
3     provide basic-init systemd
4     require basic-system
5    
6     set_system_service()
7     {
8 niro 2269 local command="${CLASS_ARGV[0]}"
9     local service="${CLASS_ARGV[1]}"
10     local opts="${CLASS_ARGV[2]}"
11 niro 2079
12     [[ -z ${command} ]] && help_system_service && return 1
13     [[ -z ${service} ]] && help_system_service && return 1
14    
15     case "${command}" in
16 niro 2648 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 niro 2079 esac
24     }
25    
26     get_system_service()
27     {
28 niro 2269 local command="${CLASS_ARGV[0]}"
29     local service="${CLASS_ARGV[1]}"
30 niro 2079
31     [[ -z ${command} ]] && help_system_service && return 1
32     [[ -z ${service} ]] && help_system_service && return 1
33    
34     case "${command}" in
35 niro 2648 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 niro 2079 esac
40     }