service.py 605 B

123456789101112131415161718192021222324
  1. from comar.service import *
  2. import os
  3. serviceType = "local"
  4. serviceDesc = _({"en": "GPS Daemon",
  5. "tr": "GPS Hizmeti"})
  6. serviceDefault = "off"
  7. @synchronized
  8. def start():
  9. startService(command="/usr/sbin/gpsd",
  10. args="-P /run/gpsd.pid -F /run/sock %s %s" %
  11. (config.get("OPTIONS", "-n"), config.get("DEVICE", "/dev/ttyUSB0")))
  12. @synchronized
  13. def stop():
  14. stopService(pidfile="/run/gpsd.pid", donotify=True)
  15. if os.path.exists("/run/gpsd.pid"):
  16. os.unlink("/run/gpsd.pid")
  17. def status():
  18. return isServiceRunning("/run/gpsd.pid")