Magellan Linux

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

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 2079 by niro, Fri May 10 11:37:38 2013 UTC revision 2084 by niro, Fri May 10 13:15:26 2013 UTC
# Line 12  set_system_service() Line 12  set_system_service()
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    
15   if [[ -n $(systemctl status ${service} | grep 'Reason: No such file or directory') ]]   local chrooted
16     if [[ -n ${MROOT} ]] && [[ ${MROOT} != / ]]
17     then
18     chrooted="system_chroot"
19     case ${command} in
20     start|stop|restart|reload)
21     eecho "Command not available while \$MROOT is set"
22     return 1
23     ;;
24     esac
25     fi
26    
27     if [[ -n $(${chrooted} systemctl status ${service} | grep 'Reason: No such file or directory') ]]
28   then   then
29   eecho "Service '${service}' unkown!"   eecho "Service '${service}' unkown!"
30   return 1   return 1
31   fi   fi
32    
33   case "${command}" in   case "${command}" in
34   start) systemctl start "${service}" ;;   start) ${chrooted} systemctl start "${service}" ;;
35   stop) systemctl stop "${service}" ;;   stop) ${chrooted} systemctl stop "${service}" ;;
36   restart) systemctl try-restart "${service}" ;;   restart) ${chrooted} systemctl try-restart "${service}" ;;
37   reload) systemctl reload-or-try-restart "${service}" ;;   reload) ${chrooted} systemctl reload-or-try-restart "${service}" ;;
38   add) systemctl enable "${service}" ;;   add) ${chrooted} systemctl enable "${service}" ;;
39   del) systemctl disable "${service}" ;;   del) ${chrooted} systemctl disable "${service}" ;;
40   *) help_system_service && return ;;   *) help_system_service && return ;;
41   esac   esac
42  }  }
# Line 37  get_system_service() Line 49  get_system_service()
49   [[ -z ${command} ]] && help_system_service && return 1   [[ -z ${command} ]] && help_system_service && return 1
50   [[ -z ${service} ]] && help_system_service && return 1   [[ -z ${service} ]] && help_system_service && return 1
51    
52   if [[ -n $(systemctl status ${service} | grep 'Reason: No such file or directory') ]]   local chrooted
53     if [[ -n ${MROOT} ]] && [[ ${MROOT} != / ]]
54     then
55     chrooted="system_chroot"
56     case ${command} in
57     status)
58     eecho "Command not available while \$MROOT is set"
59     return 1
60     ;;
61     esac
62     fi
63    
64     if [[ -n $(${chrooted} systemctl status ${service} | grep 'Reason: No such file or directory') ]]
65   then   then
66   eecho "Service '${service}' unkown!"   eecho "Service '${service}' unkown!"
67   return 1   return 1
68   fi   fi
69    
70   case "${command}" in   case "${command}" in
71   status) systemctl status "${service}" ;;   status) ${chrooted} systemctl status "${service}" ;;
72   enabled) systemctl is-enabled "${service}"; rvecho "$?" ;;   enabled) ${chrooted} systemctl is-enabled "${service}"; rvecho "$?" ;;
73   runlevel) rvecho "$(readline ${MROOT}/etc/systemd/system/default.target)" ;;   runlevel) rvecho "$(readline ${MROOT}/etc/systemd/system/default.target)" ;;
74   *) help_system_service && return ;;   *) help_system_service && return ;;
75   esac   esac

Legend:
Removed from v.2079  
changed lines
  Added in v.2084