service.py 1019 B

123456789101112131415161718192021222324252627282930313233343536
  1. from comar.service import *
  2. serviceType = "server"
  3. serviceDesc = _({"en": "Apache Web Server",
  4. "tr": "Apache Web Sunucusu"})
  5. serviceConf = "apache2"
  6. PIDFILE = "/run/apache2.pid"
  7. @synchronized
  8. def start():
  9. import os
  10. os.environ["LC_ALL"] = "C"
  11. os.environ["LANG"] = "C"
  12. startService(command="/usr/sbin/apache2",
  13. args="-d /usr/lib/apache2/ -f /etc/apache2/httpd.conf %s -k start" % config.get("APACHE2_OPTS", ""),
  14. pidfile=PIDFILE,
  15. donotify=True)
  16. @synchronized
  17. def stop():
  18. stopService(command="/usr/sbin/apache2",
  19. args="-d /usr/lib/apache2/ -f /etc/apache2/httpd.conf %s -k stop" % config.get("APACHE2_OPTS", ""),
  20. donotify=True)
  21. import time
  22. time.sleep(3)
  23. def reload():
  24. stopService(command="/usr/sbin/apache2",
  25. args="-d /usr/lib/apache2/ -f /etc/apache2/httpd.conf %s -k graceful" % config.get("APACHE2_OPTS", ""))
  26. def status():
  27. return isServiceRunning(PIDFILE)