]>
git.proxmox.com Git - mirror_ifupdown2.git/blob - ifupdown2/ifupdownaddons/systemutils.py
3 # Copyright 2015-2017 Cumulus Networks, Inc. All rights reserved.
4 # Author: Roopa Prabhu, roopa@cumulusnetworks.com
10 from ifupdown2
.ifupdown
.utils
import utils
11 from ifupdown2
.ifupdownaddons
.utilsbase
import *
13 from ifupdown
.utils
import utils
14 from ifupdownaddons
.utilsbase
import *
19 def is_service_running(cls
, procname
=None, pidfile
=None):
20 utilsobj
= utilsBase()
22 if os
.path
.exists(pidfile
):
23 pid
= utilsobj
.read_file_oneline(pidfile
)
24 if not os
.path
.exists('/proc/%s' %pid
):
32 utils
.exec_command('%s %s' %
33 (utils
.pidof_cmd
, procname
))
42 def check_service_status(cls
, servicename
=None):
46 utils
.exec_commandl([utils
.service_cmd
,
47 servicename
, 'status'])
49 # XXX: check for subprocess errors vs os error
54 def is_process_running(self
, processname
):
58 utils
.exec_command('%s %s' %
59 (utils
.pidof_cmd
, processname
))