service.py 707 B

12345678910111213141516171819202122232425262728293031323334353637
  1. # -*- coding: utf-8 -*-
  2. from comar.service import *
  3. import os
  4. serviceType = "local"
  5. serviceDesc = _({"en": "FIXME",
  6. "tr": "FIXME"})
  7. serviceDefault = "on"
  8. PIDFILE = "/run/bumblebeed.pid"
  9. DAEMON = "/usr/sbin/bumblebeed"
  10. @synchronized
  11. def start():
  12. os.system("modprobe bbswitch load_state=0 unload_state=1")
  13. startService(command=DAEMON,
  14. args="--daemon",
  15. detach=True)
  16. os.system("pidof -o %PPID " + "%s > %s" % (DAEMON, PIDFILE))
  17. @synchronized
  18. def stop():
  19. stopService(pidfile=PIDFILE,
  20. donotify=True)
  21. try:
  22. os.unlink(PIDFILE)
  23. except:
  24. pass
  25. def status():
  26. return isServiceRunning(pidfile=PIDFILE)