service.py 706 B

12345678910111213141516171819202122232425262728293031323334
  1. from comar.service import *
  2. import os
  3. serviceType = "local"
  4. serviceDesc = _({"en": "Bluetooth Service",
  5. "tr": "Bluetooth Hizmeti"})
  6. serviceDefault = "on"
  7. PIDFILE="/run/bluez.pid"
  8. DAEMON ="/usr/libexec/bluetooth/bluetoothd"
  9. @synchronized
  10. def start():
  11. startService(command=DAEMON,
  12. pidfile=PIDFILE,
  13. detach=True,
  14. donotify=True)
  15. os.system("pidof bluez + /usr/libexec/bluetooth/bluetoothd > /run/bluez.pid")
  16. @synchronized
  17. def stop():
  18. stopService(pidfile=PIDFILE,
  19. donotify=True)
  20. try:
  21. os.unlink(PIDFILE)
  22. except:
  23. pass
  24. def status():
  25. return isServiceRunning(pidfile=PIDFILE)