chroot_service.py 815 B

1234567891011121314151617181920212223242526272829
  1. # -*- coding: utf-8 -*-
  2. import os
  3. from comar.service import *
  4. serviceType = "server"
  5. serviceDesc = _({"en": "BIND Daemon (chroot)",
  6. "tr": "BIND Servisi (chroot)"})
  7. serviceConf = "named"
  8. chrootDir = "/var/named/chroot"
  9. PIDFILE = "%s/var/run/named/named.pid" % chrootDir
  10. @synchronized
  11. def start():
  12. startService(command="/usr/sbin/named",
  13. args="-u named -n %s %s -t %s" % (config.get("CPU", "1"),
  14. config.get("OPTIONS", ""),
  15. chrootDir),
  16. makepid=True,
  17. pidfile=PIDFILE,
  18. donotify=True)
  19. @synchronized
  20. def stop():
  21. stopService(pidfile=PIDFILE,
  22. donotify=True)
  23. def status():
  24. return isServiceRunning(PIDFILE)