98 |
fi |
fi |
99 |
} |
} |
100 |
|
|
|
|
|
101 |
# adds systemd units to runlevels and starts them |
# adds systemd units to runlevels and starts them |
102 |
# mstartunit service {/path/to/service_exec} |
# mstartunit service {/path/to/service_exec} |
103 |
mstartunit() |
mstartunit() |
141 |
# do not start services on bootstrap or MROOT!=/ |
# do not start services on bootstrap or MROOT!=/ |
142 |
if [[ ${MAGE_BOOTSTRAP} != true ]] && [[ -z ${MROOT} ]] || [[ ${MROOT} = / ]] |
if [[ ${MAGE_BOOTSTRAP} != true ]] && [[ -z ${MROOT} ]] || [[ ${MROOT} = / ]] |
143 |
then |
then |
144 |
|
echo -e " ${COLBLUE}[${COLGREEN}+${COLBLUE}]${COLDEFAULT} starting unit ${service} ..." |
145 |
# start or restart the service |
# start or restart the service |
146 |
systemctl try-restart ${service} |
# dont use try-restart, works only with active services! |
147 |
|
systemctl restart ${service} |
148 |
fi |
fi |
149 |
} |
} |
150 |
|
|
194 |
# do not stop services on bootstrap or MROOT!=/ |
# do not stop services on bootstrap or MROOT!=/ |
195 |
if [[ ${MAGE_BOOTSTRAP} != true ]] && [[ -z ${MROOT} ]] || [[ ${MROOT} = / ]] |
if [[ ${MAGE_BOOTSTRAP} != true ]] && [[ -z ${MROOT} ]] || [[ ${MROOT} = / ]] |
196 |
then |
then |
197 |
|
echo -e " ${COLBLUE}[${COLGREEN}+${COLBLUE}]${COLDEFAULT} stopping unit ${service} ..." |
198 |
systemctl stop ${service} |
systemctl stop ${service} |
199 |
# try harder |
# try harder |
200 |
if [[ -n $(pidof ${service_exec}) ]] |
if [[ -n $(pidof ${service_exec}) ]] |
240 |
esac |
esac |
241 |
fi |
fi |
242 |
|
|
243 |
|
# reload daemon to honor changed unit files |
244 |
|
systemctl daemon-reload |
245 |
|
|
246 |
# do not stop services on bootstrap or MROOT!=/ |
# do not stop services on bootstrap or MROOT!=/ |
247 |
if [[ ${MAGE_BOOTSTRAP} != true ]] && [[ -z ${MROOT} ]] || [[ ${MROOT} = / ]] |
if [[ ${MAGE_BOOTSTRAP} != true ]] && [[ -z ${MROOT} ]] || [[ ${MROOT} = / ]] |
248 |
then |
then |