mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
added sysv functions
This commit is contained in:
parent
ac8842eee8
commit
c880c1a78d
1 changed files with 21 additions and 1 deletions
|
@ -27,4 +27,24 @@
|
|||
# USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
#
|
||||
|
||||
# This file is a placeholder for common code for the future split 'service' modules.
|
||||
from __future__ import (absolute_import, division, print_function)
|
||||
__metaclass__ = type
|
||||
|
||||
import os
|
||||
import glob
|
||||
|
||||
def sysv_is_enabled(name):
|
||||
return bool(glob.glob('/etc/rc?.d/S??%s' % name))
|
||||
|
||||
def get_sysv_script(name):
|
||||
|
||||
if name.startswith('/'):
|
||||
result = name
|
||||
else:
|
||||
result = '/etc/init.d/%s' % name
|
||||
|
||||
return result
|
||||
|
||||
def sysv_exists(name):
|
||||
return os.path.exists(get_sysv_script(name))
|
||||
|
||||
|
|
Loading…
Reference in a new issue