Added linux_has_systemd_service(): check if systemd unit file is installed

This commit is contained in:
patvdv
2018-11-18 21:25:49 +01:00
parent bd271a5345
commit 18aa1be5da
7 changed files with 100 additions and 14 deletions
+18
View File
@@ -212,6 +212,24 @@ print ${_HAS_NM}
return 0
}
# -----------------------------------------------------------------------------
# @(#) FUNCTION: linux_has_systemd_service()
# DOES: check if a systemd service is present (unit file)
# EXPECTS: name of service [string]
# OUTPUTS: 0=not installed; 1=installed
# RETURNS: 0=success; 1=error
# REQUIRES: n/a
function linux_has_systemd_service
{
(( ARG_DEBUG > 0 && ARG_DEBUG_LEVEL > 0 )) && set "${DEBUG_OPTS}"
typeset _RC=0
systemctl list-unit-files 2>/dev/null | grep -c "^{$1}" 2>/dev/null
_RC=$?
return ${_RC}
}
#******************************************************************************
# END of script
#******************************************************************************