Skip to content

Commit

Permalink
Merge pull request #18 from sonroyaalmerol/fix-agent
Browse files Browse the repository at this point in the history
Fix agent update old error
  • Loading branch information
sonroyaalmerol authored Jan 6, 2025
2 parents 8ff57e0 + bc3332d commit 27f97ac
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
7 changes: 6 additions & 1 deletion cmd/windows_agent/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ package main
import (
"fmt"
"os"
"path"
"time"

"github.com/kardianos/service"
Expand All @@ -17,7 +18,11 @@ var Version = "v0.0.0"

func main() {
execPath, _ := os.Executable()
_ = os.RemoveAll(execPath + ".old")
fileName := path.Base(execPath)
filePath := path.Dir(execPath)

fullOldPath := path.Join(filePath, "."+fileName+".old")
_ = os.RemoveAll(fullOldPath)

svcConfig := &service.Config{
Name: "PBSPlusAgent",
Expand Down
4 changes: 3 additions & 1 deletion internal/backend/backup/jobrun.go
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,8 @@ func RunBackup(job *store.Job, storeInstance *store.Store) (*store.Task, error)
}

cmdArgs := []string{
"--nofile=1024:1024",
"/usr/bin/proxmox-backup-client",
"backup",
fmt.Sprintf("%s.pxar:%s", strings.ReplaceAll(job.Target, " ", "-"), srcPath),
"--repository",
Expand Down Expand Up @@ -159,7 +161,7 @@ func RunBackup(job *store.Job, storeInstance *store.Store) (*store.Task, error)

_ = FixDatastore(job, storeInstance)

cmd := exec.Command("/usr/bin/proxmox-backup-client", cmdArgs...)
cmd := exec.Command("/usr/bin/prlimit", cmdArgs...)
cmd.Env = os.Environ()
cmd.Env = append(cmd.Env, fmt.Sprintf("PBS_PASSWORD=%s", storeInstance.APIToken.Value))

Expand Down

0 comments on commit 27f97ac

Please sign in to comment.