lock file feature
This commit is contained in:
parent
01b45aaab8
commit
21f4f9dcab
5 changed files with 50 additions and 6 deletions
26
includes/ps1/lockfile.ps1
Normal file
26
includes/ps1/lockfile.ps1
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
function new-lock {
|
||||
if ($env:temp) {
|
||||
$lockFile = Join-Path -Path $env:temp -ChildPath 'lockfile_pubg.lock'
|
||||
}
|
||||
else {
|
||||
$lockFile = "/tmp/lockfile_pubg.lock"
|
||||
}
|
||||
if (Test-Path -Path $lockFile) {
|
||||
Write-Host "Job is already running."
|
||||
Exit
|
||||
}
|
||||
New-Item -ItemType File -Path $lockFile | Out-Null
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
function remove-lock {
|
||||
if ($env:temp) {
|
||||
$lockFile = Join-Path -Path $env:temp -ChildPath 'lockfile_pubg.lock'
|
||||
}
|
||||
else {
|
||||
$lockFile = "/tmp/lockfile_pubg.lock"
|
||||
}
|
||||
Remove-Item -Path $lockFile
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue