service.py 962 B

1234567891011121314151617181920212223242526272829303132333435
  1. # -*- coding: utf-8 -*-
  2. from comar.service import *
  3. serviceType = "local"
  4. serviceDefault = "off"
  5. serviceDesc = _({"en": "InfraRed Controller Manager",
  6. "tr": "Kızılötesi Denetleyici Yöneticisi"})
  7. lircdpid = "/var/run/lirc/lircd.pid"
  8. @synchronized
  9. def start():
  10. lircmodule = config.get("LIRC_MODULE", "")
  11. if lircmodule != "":
  12. run("modprobe %s" % lircmodule)
  13. reply = startService(command="/usr/sbin/lircd",
  14. args=config.get("LIRCD_OPTS", ""),
  15. pidfile=lircdpid,
  16. donotify=True)
  17. if reply == 0 and config.get("USE_LIRCMD", "no") == "yes":
  18. startService(command="/usr/sbin/lircmd")
  19. @synchronized
  20. def stop():
  21. reply = stopService(pidfile=lircdpid,
  22. donotify=True)
  23. if config.get("USE_LIRCMD", "no") == "yes":
  24. stopService(command="/usr/sbin/lircmd")
  25. def status():
  26. return isServiceRunning(lircdpid)