service.py 944 B

123456789101112131415161718192021222324252627282930313233343536
  1. from comar.service import *
  2. serviceType = "local"
  3. serviceDesc = _({"en": "ACPI Daemon",
  4. "tr": "ACPI Hizmeti"})
  5. serviceDefault = "on"
  6. PIDFILE = "/run/acpid.pid"
  7. #MSG_NO_PIDFILE = _({
  8. # "en" : "Could not reload acpid daemon as the PID file %s does not exist." % PIDFILE,
  9. # "tr" : "%s PID dosyası mevcut olmadığından acpid hizmeti yeniden yüklenemiyor." % PIDFILE,
  10. # })
  11. @synchronized
  12. def start():
  13. startService(command="/usr/sbin/acpid",
  14. args=config.get("OPTIONS", "-p /run/acpid.pid"),
  15. donotify=True)
  16. @synchronized
  17. def stop():
  18. stopService(pidfile=PIDFILE,
  19. donotify=True)
  20. #def reload():
  21. # import signal
  22. # import os
  23. # try:
  24. # os.kill(int(open(PIDFILE, "r").read().strip()), signal.SIGHUP)
  25. # except:
  26. # fail(MSG_NO_PIDFILE)
  27. def status():
  28. return isServiceRunning(pidfile=PIDFILE)