[Spambayes-checkins] spambayes/windows pop3proxy_service.py, 1.10, 1.11

Adam Walker xenogeist at users.sourceforge.net
Mon Sep 8 19:26:18 EDT 2003


Update of /cvsroot/spambayes/spambayes/windows
In directory sc8-pr-cvs1:/tmp/cvs-serv24014/windows

Modified Files:
	pop3proxy_service.py 
Log Message:
Update the windows service to use the new script names.

Index: pop3proxy_service.py
===================================================================
RCS file: /cvsroot/spambayes/spambayes/windows/pop3proxy_service.py,v
retrieving revision 1.10
retrieving revision 1.11
diff -C2 -d -r1.10 -r1.11
*** pop3proxy_service.py	31 Aug 2003 02:17:46 -0000	1.10
--- pop3proxy_service.py	9 Sep 2003 01:26:16 -0000	1.11
***************
*** 1,3 ****
! # Run the pop3proxy as a WinNT service.  Should work on Windows 2000
  # and Windows XP.
  #
--- 1,3 ----
! # Run the sb_server as a WinNT service.  Should work on Windows 2000
  # and Windows XP.
  #
***************
*** 26,29 ****
--- 26,31 ----
      this_filename=__file__
  except NameError:
+     this_filename = sys.argv[0]
+ if not os.path.isabs(sys.argv[0]):
      # Python 2.3 __main__
      # patch up sys.argv, as our cwd will confuse service registration code
***************
*** 31,37 ****
--- 33,42 ----
      this_filename = sys.argv[0]
  
+ print sys.argv[0]
  sb_dir = os.path.dirname(os.path.dirname(this_filename))
+ sb_scripts_dir = os.path.join(sb_dir,"scripts")
  
  sys.path.insert(0, sb_dir)
+ sys.path.insert(-1, sb_scripts_dir)
  # and change directory here, so pop3proxy uses the default
  # config file etc
***************
*** 44,48 ****
  
  # The spambayes imports we need.
! import pop3proxy
  
  # The win32 specific modules.
--- 49,53 ----
  
  # The spambayes imports we need.
! import sb_server
  
  # The win32 specific modules.
***************
*** 68,73 ****
  
  class Service(win32serviceutil.ServiceFramework):
      _svc_name_ = "pop3proxy"
!     _svc_display_name_ = "SpamBayes pop3proxy Service"
      _svc_deps_ =  ['tcpip'] # We depend on the tcpip service.
      def __init__(self, args):
--- 73,80 ----
  
  class Service(win32serviceutil.ServiceFramework):
+     # The script name was changed to "sb_server" but I'll leave this as pop3proxy
+     # overwise people might accidently run two proxies.
      _svc_name_ = "pop3proxy"
!     _svc_display_name_ = "SpamBayes Service"
      _svc_deps_ =  ['tcpip'] # We depend on the tcpip service.
      def __init__(self, args):
***************
*** 80,90 ****
          self.ReportServiceStatus(win32service.SERVICE_STOP_PENDING)
          self.event_stopping.set()
!         pop3proxy.stop(pop3proxy.state)        
          
  
      def SvcDoRun(self):
          # Setup our state etc
!         pop3proxy.prepare(state=pop3proxy.state)
!         assert not pop3proxy.state.launchUI, "Service can't launch a UI"
  
          # Start the thread running the server.
--- 87,97 ----
          self.ReportServiceStatus(win32service.SERVICE_STOP_PENDING)
          self.event_stopping.set()
!         sb_server.stop(sb_server.state)        
          
  
      def SvcDoRun(self):
          # Setup our state etc
!         sb_server.prepare(state=sb_server.state)
!         assert not sb_server.state.launchUI, "Service can't launch a UI"
  
          # Start the thread running the server.
***************
*** 122,126 ****
          
          # Write another event log record.
!         s = pop3proxy.state
          status = " after %d sessions (%d ham, %d spam, %d unsure)" % \
                  (s.totalSessions, s.numHams, s.numSpams, s.numUnsure)
--- 129,133 ----
          
          # Write another event log record.
!         s = sb_server.state
          status = " after %d sessions (%d ham, %d spam, %d unsure)" % \
                  (s.totalSessions, s.numHams, s.numSpams, s.numUnsure)
***************
*** 135,139 ****
          try:
              try:
!                 pop3proxy.start(pop3proxy.state)
              except SystemExit:
                  # user requested shutdown
--- 142,146 ----
          try:
              try:
!                 sb_server.start(sb_server.state)
              except SystemExit:
                  # user requested shutdown





More information about the Spambayes-checkins mailing list