Magellan Linux

Contents of /mcore-src/trunk/mcore-tools/daemon/client/include/systemd.client.class

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2079 - (show annotations) (download)
Fri May 10 11:37:38 2013 UTC (11 years ago) by niro
File size: 1312 byte(s)
-split systemd, sysvinit, fbsplash and plymouth functions in single classes so no runtime checks are required and the correct version get installed right away
1 # $Id$
2
3 provide basic-init systemd
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 if [[ -n $(systemctl status ${service} | grep 'Reason: No such file or directory') ]]
16 then
17 eecho "Service '${service}' unkown!"
18 return 1
19 fi
20
21 case "${command}" in
22 start) systemctl start "${service}" ;;
23 stop) systemctl stop "${service}" ;;
24 restart) systemctl try-restart "${service}" ;;
25 reload) systemctl reload-or-try-restart "${service}" ;;
26 add) systemctl enable "${service}" ;;
27 del) systemctl disable "${service}" ;;
28 *) help_system_service && return ;;
29 esac
30 }
31
32 get_system_service()
33 {
34 local command="$1"
35 local service="$2"
36
37 [[ -z ${command} ]] && help_system_service && return 1
38 [[ -z ${service} ]] && help_system_service && return 1
39
40 if [[ -n $(systemctl status ${service} | grep 'Reason: No such file or directory') ]]
41 then
42 eecho "Service '${service}' unkown!"
43 return 1
44 fi
45
46 case "${command}" in
47 status) systemctl status "${service}" ;;
48 enabled) systemctl is-enabled "${service}"; rvecho "$?" ;;
49 runlevel) rvecho "$(readline ${MROOT}/etc/systemd/system/default.target)" ;;
50 *) help_system_service && return ;;
51 esac
52 }