-
-
Save mastro35/28d77339656b92d14e7a020367717b2f to your computer and use it in GitHub Desktop.
This file contains 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 time | |
import random | |
from pathlib import Path | |
from SMWinservice import SMWinservice | |
class PythonCornerExample(SMWinservice): | |
_svc_name_ = "PythonCornerExample" | |
_svc_display_name_ = "Python Corner's Winservice Example" | |
_svc_description_ = "That's a great winservice! :)" | |
def start(self): | |
self.isrunning = True | |
def stop(self): | |
self.isrunning = False | |
def main(self): | |
i = 0 | |
while self.isrunning: | |
random.seed() | |
x = random.randint(1, 1000000) | |
Path(f'c:\\{x}.txt').touch() | |
time.sleep(5) | |
if __name__ == '__main__': | |
PythonCornerExample.parse_command_line() |
Hi cervelle
thanks for the Link , I tried it , but its not working .
any other solution?
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thanks for the code , I able to create the service , service runs absolutly fine .
But when i run the below command from python script , its runnig fine from debug mode , but when i try to run from service its not executing , can you please tel me the exact reason for this?
command4 = '"D:\Prognocis\Backup\robocopy.exe" ' + "/MIR W:\Formulary\FBS_3_0 D:\Formularylocal\Formulary_3_0 ."
os.system(command4)