foam_sync.ps1 (LIFEBALANCE) 2025-06-19T14:11:15Z
This commit is contained in:
@ -12,17 +12,14 @@ $scriptName = (Get-Item $scriptPath).Name
|
||||
$taskName = 'FoamGitSync'
|
||||
$taskDescription = "Periodically synchronizes the Git repository at $scriptDir using $scriptName."
|
||||
$frequencyMinutes = 2
|
||||
$timeLimitSeconds = 30
|
||||
|
||||
if (-not (Test-Path -Path $logDir)) {
|
||||
New-Item -ItemType Directory -Path $logDir -Force | Out-Null
|
||||
}
|
||||
$logFilePath = Join-Path -Path $logDir -ChildPath "foam_sync.log"
|
||||
|
||||
Start-Transcript -Path $logFilePath -Append -IncludeInvocationHeader -Force
|
||||
|
||||
try {
|
||||
|
||||
|
||||
Write-Host "Script: $scriptName at $scriptPath"
|
||||
Write-Host "Repository directory: $scriptDir"
|
||||
Write-Host "Sync frequency: Every $frequencyMinutes minutes"
|
||||
@ -35,8 +32,7 @@ try {
|
||||
$action = New-ScheduledTaskAction -Execute "powershell.exe" -Argument $actionArgumentForRegistration
|
||||
|
||||
# Task settings
|
||||
$taskExecutionTimeLimit = New-TimeSpan -Seconds 30
|
||||
$settings = New-ScheduledTaskSettingsSet -ExecutionTimeLimit $taskExecutionTimeLimit
|
||||
$settings = New-ScheduledTaskSettingsSet -ExecutionTimeLimit $(New-TimeSpan -Seconds $timeLimitSeconds)
|
||||
|
||||
# Check and configure the scheduled task
|
||||
try {
|
||||
|
||||
Reference in New Issue
Block a user