Created
          July 12, 2018 09:32 
        
      - 
      
 - 
        
Save vvvhung/188c8a0ddf575f69aab357e1190bec04 to your computer and use it in GitHub Desktop.  
    Window service python
  
        
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | import os | |
| config_file = os.path.join(os.path.dirname(os.path.abspath(__file__)), "config.txt") | |
| config = {} | |
| f = open(config_file, 'r') | |
| for line in f: | |
| if line.strip()[0] != '#': | |
| sep = line.find(":") | |
| key = line[:sep].strip() | |
| val = line[sep+1:].strip() | |
| config[key] = val | |
| print(config) | |
| f.close() | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | #allow_extensions: pdf, tif | |
| allow_extensions: pdf | |
| ai_api : http://192.168.99.100:5000/ocr/ | |
| card_type_file : C:\Users\vieth\Downloads\Card Type Master_20180628.xlsx | |
| search_method : ExcelDirect | |
| #search_method : ElasticSearch | |
| printer_name : FUJI XEROX ApeosPort-VI C4471 | |
| #print_tool : FoxitReader | |
| #tool_file : C:\Program Files (x86)\Foxit Software\Foxit Reader\FoxitReader.exe | |
| #print_tool : SumatraPDF | |
| #tool_file : C:\Program Files\SumatraPDF\SumatraPDF.exe | |
| print_tool : GhostScript | |
| tool_file : C:\Program Files\gs\gs9.23\bin\gswin64c.exe | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | @echo off | |
| set /p PASSWORD=Enter Password: | |
| nssm.exe install SERVICE_NAME api_wrapper.exe Start Automatic AppDirectory %CD% AppStdout %CD%\log.txt AppStderr %CD%\log.txt && nssm.exe set SERVICE_NAME ObjectName .\%USERNAME% %PASSWORD% && nssm.exe start SERVICE_NAME | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | pyinstaller api_wrapper.py | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | nssm.exe restart SERVICE_NAME | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | nssm.exe stop SERVICE_NAME & nssm.exe remove SERVICE_NAME | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment