service.py 787 B

12345678910111213141516171819202122232425262728293031
  1. # -*- coding: utf-8 -*-
  2. from comar.service import *
  3. serviceType = "local"
  4. serviceDesc = _({"en": "Cgroup Management Daemon",
  5. "tr": "Cgroup Yönetim Servisi"})
  6. serviceDefault="on"
  7. CGMANAGER_PIDFILE = "/run/cgmanager.pid"
  8. CGPROXY_PIDFILE = "/run/cgproxy.pid"
  9. @synchronized
  10. def start():
  11. startService(command="/usr/bin/cgmanager",
  12. args="--daemon",
  13. donotify=True)
  14. startService(command="/usr/bin/cgproxy",
  15. args="--daemon",
  16. donotify=True)
  17. @synchronized
  18. def stop():
  19. stopService(pidfile=CGPROXY_PIDFILE, donotify=True)
  20. stopService(pidfile=CGMANAGER_PIDFILE, donotify=True)
  21. def status():
  22. result = isServiceRunning(CGMANAGER_PIDFILE) and isServiceRunning(CGPROXY_PIDFILE)
  23. return result