service.py 702 B

12345678910111213141516171819202122232425262728293031
  1. from comar.service import *
  2. serviceType="server"
  3. serviceDesc = _({"en": "S.M.A.R.T. monitoring daemon",
  4. "tr": "S.M.A.R.T. disk izleme hizmeti"})
  5. serviceConf = "smartd"
  6. PIDFILE = "/run/smartd.pid"
  7. @synchronized
  8. def start():
  9. args = "-p %s" % PIDFILE
  10. if config.get("smartd_opts"):
  11. args = "%s %s" % (args, config.get("smartd_opts"))
  12. startService(command="/usr/sbin/smartd",
  13. args=args,
  14. donotify=True)
  15. @synchronized
  16. def stop():
  17. stopService(pidfile=PIDFILE,
  18. donotify=True)
  19. def reload():
  20. # FIXME: That's bad.
  21. run("/usr/bin/killall -HUP smartd")
  22. def status():
  23. return isServiceRunning(pidfile=PIDFILE)