service.py 662 B

123456789101112131415161718192021222324252627282930313233343536
  1. # -*- coding: utf-8 -*-
  2. from comar.service import *
  3. import os
  4. serviceType="server"
  5. serviceDesc=_({"en": "lxdm Server",
  6. "tr": "lxdm Sunucusu"})
  7. serviceDefault="on"
  8. PIDFILE="/run/lxdm.pid"
  9. DAEMON="/usr/sbin/lxdm"
  10. @synchronized
  11. def start():
  12. if status():
  13. return
  14. reply = startService(command=DAEMON,
  15. pidfile=PIDFILE,
  16. donotify=True)
  17. if reply == 0:
  18. run("/usr/sbin/lxdm")
  19. @synchronized
  20. def stop():
  21. stopService(pidfile=PIDFILE,
  22. donotify=True)
  23. try:
  24. os.unlink(PIDFILE)
  25. except OSError:
  26. pass
  27. def status():
  28. return isServiceRunning(PIDFILE)