Files
exemone_agent_installer/roles/one_agent/templates/systemctl_enable.sh.j2

33 lines
798 B
Django/Jinja

#!/bin/sh
SYSTEMCTL=$(which systemctl 2> /dev/null)
SERVICE=$(which service 2> /dev/null)
CHKCONFIG=$(which chkconfig 2> /dev/null)
if [ "$(id -u)" -ne 0 ]; then
echo "Not a root user. Not support service registration"
echo "Use binary mode"
exit 1
fi
if [ -n "${SYSTEMCTL}" ]; then
# SELinux setting
chcon -t bin_t {{ EXEM_HOME }}/host/script/binary_start.sh
chcon -R -t var_run_t {{ EXEM_HOME }}/host/data
chcon -R -t var_run_t {{ EXEM_HOME }}/host/service
if [ ! -e "/etc/systemd/system/exem-host-agent.service" ]; then
systemctl enable {{ EXEM_HOME }}/host/service/exem-host-agent.service
fi
systemctl daemon-reload
echo "exem-host-agent is enabled"
else
echo "this OS version that does not support service registration"
echo "Use binary mode"
exit 1
fi