Files
main/network/connection/NetworkManager/comar/service.py
T
2017-03-15 13:20:00 +03:00

45 lines
1.1 KiB
Python
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# -*- coding: utf-8 -*-
from comar.service import *
import os
serviceType = "local"
serviceDesc = _({"en": "Network Manager",
"tr": "Ağ Yöneticisi Hizmeti"})
serviceDefault = "conditional"
MSG_BACKEND_WARNING = _({
"en" : "NetworkManager is not enabled by default. You can change this from /etc/conf.d/NetworkManager.",
"tr" : "NetworkManager öntanımlı olarak etkin değil. /etc/conf.d/NetworkManager dosyasından bu ayarı değiştirebilirsiniz."
})
PIDFILE="/run/NetworkManager/NetworkManager.pid"
USETHIS=eval(config.get("DEFAULT", "True"))
@synchronized
def start():
if not USETHIS:
fail(MSG_BACKEND_WARNING)
startService(command="/usr/sbin/NetworkManager",
args="--pid-file=%s" % PIDFILE,
donotify=True)
@synchronized
def stop():
stopService(pidfile=PIDFILE,
donotify=True)
try:
os.unlink(PIDFILE)
except:
pass
def ready():
if not USETHIS:
fail(MSG_BACKEND_WARNING)
else:
start()
def status():
return isServiceRunning(pidfile=PIDFILE)