ntpd-service.py 604 B

1234567891011121314151617181920212223242526272829
  1. # -*- coding: utf-8 -*-
  2. from comar.service import *
  3. import os
  4. serviceType = "server"
  5. serviceDesc = _({"en": "NTP Daemon",
  6. "tr": "NTP Hizmeti"})
  7. serviceConf = "ntpd"
  8. PIDFILE = "/run/ntpd.pid"
  9. @synchronized
  10. def start():
  11. startService(command="/usr/sbin/ntpd",
  12. args=config.get("OPTIONS", "-x -u ntp:ntp -p %s " % PIDFILE),
  13. donotify=True)
  14. @synchronized
  15. def stop():
  16. stopService(pidfile=PIDFILE,
  17. donotify=True)
  18. if os.path.exists(PIDFILE):
  19. os.unlink(PIDFILE)
  20. def status():
  21. return isServiceRunning(pidfile=PIDFILE)