Added linux_has_systemd_service(): check if systemd unit file is installed
This commit is contained in:
@@ -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
|
||||
#******************************************************************************
|
||||
|
||||
Reference in New Issue
Block a user