Created
December 24, 2016 06:20
-
-
Save uuklanger/757250d9c8e688455312ba0f4bfd916a 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
@echo off | |
REM | |
REM Example of howto use a lockfile in BATCH language | |
REM | |
:INIT | |
CD \BatchJobs | |
ECHO Current Working Directory | |
CD | |
:START | |
IF EXIST NIGHTLYRUN.LOCK GOTO SKIP_WORK | |
ECHO Turning on Lock | |
ECHO ""LOCK"" > NIGHTLYRUN.LOCK | |
REM Do work here. this is where your program or process goes. | |
ECHO Turning off Lock | |
DEL NIGHTLYRUN.LOCK | |
GOTO DONE | |
:SKIP_WORK | |
ECHO ""This process is already running.."" | |
:DONE |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment