# $Id$ provide basic-init systemd require basic-system set_system_service() { local command="$1" local service="$2" local opts="$3" [[ -z ${command} ]] && help_system_service && return 1 [[ -z ${service} ]] && help_system_service && return 1 if [[ -n $(systemctl status ${service} | grep 'Reason: No such file or directory') ]] then eecho "Service '${service}' unkown!" return 1 fi case "${command}" in start) systemctl start "${service}" ;; stop) systemctl stop "${service}" ;; restart) systemctl try-restart "${service}" ;; reload) systemctl reload-or-try-restart "${service}" ;; add) systemctl enable "${service}" ;; del) systemctl disable "${service}" ;; *) help_system_service && return ;; esac } get_system_service() { local command="$1" local service="$2" [[ -z ${command} ]] && help_system_service && return 1 [[ -z ${service} ]] && help_system_service && return 1 if [[ -n $(systemctl status ${service} | grep 'Reason: No such file or directory') ]] then eecho "Service '${service}' unkown!" return 1 fi case "${command}" in status) systemctl status "${service}" ;; enabled) systemctl is-enabled "${service}"; rvecho "$?" ;; runlevel) rvecho "$(readline ${MROOT}/etc/systemd/system/default.target)" ;; *) help_system_service && return ;; esac }