Skip to content

Commit

Permalink
feat: create directory before check
Browse files Browse the repository at this point in the history
Signed-off-by: mlycore <[email protected]>
  • Loading branch information
mlycore committed Dec 18, 2023
1 parent 5ea5152 commit 05739d0
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions pitr/agent/internal/handler/diskspace.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,10 @@ func DiskSpace(ctx *fiber.Ctx) error {
return fmt.Errorf("invalid parameter, err wrap: %w", err)
}

if err := os.MkdirAll(in.DiskPath, 0755); err != nil {
return fmt.Errorf("mkdir [%s] failure, err wrap: %w", in.DiskPath, err)
}

// show disk space
cmd := fmt.Sprintf("df -h %s", in.DiskPath)
output, err := cmds.Exec(os.Getenv("SHELL"), cmd)
Expand Down

0 comments on commit 05739d0

Please sign in to comment.