0

I have a small loop script like this, it basically just monitors a directory if there is a file called 000.txt created, it will call up another batch file to run then delete the 000.txt file and keep going like this.....

@ECHO OFF

REM Check if 000.txt exists

:LOOP    
IF NOT EXIST D:\data\000.txt GOTO SKIP

REM mklink if 000.txt exists...

call C:\ntfs3\mklink.bat

GOTO LOOP


:SKIP
REM Crafty 1 minute delay...

PING 1.1.1.1 -n 4 -w 600 >NUL

GOTO LOOP

So my question:

Is this a good idea to running a endless loop on server like forever to monitor a folder?

Root Loop
  • 3,004
  • 9
  • 46
  • 72
  • 1
    Does it have to run endlessly? Could you run it every 5 minutes? I would run it as a windows scheduled task. – Rick S Apr 15 '14 at 17:54
  • I could set it up running every 5 mins, but user wont be able to see the changes right the way....so has to be like this – Root Loop Apr 15 '14 at 17:59
  • I don't see an issue with it. Just make sure that it gets automatically run whenever the server reboots. – Rick S Apr 15 '14 at 18:03
  • If the owner of the server says it's OK, it's OK. – Harry Johnston Apr 15 '14 at 22:03
  • The biggest danger is crashing without a chance to restart. Perhaps not likely in this case but still possible. Scheduled tasks are designed to prevent that problem. – Jeremy J Starcher Apr 16 '14 at 04:37

0 Answers0