Add maintaining log in scheduled mode

This commit is contained in:
2024-07-28 22:54:31 +02:00
parent 2e61054334
commit c8e68af09f
5 changed files with 47 additions and 8 deletions

View File

@@ -11,9 +11,6 @@ import (
"os/exec"
)
const cronLogFile = "/var/log/mysql-bkup.log"
const backupCronFile = "/usr/local/bin/backup_cron.sh"
func CreateCrontabScript(disableCompression bool, storage string) {
//task := "/usr/local/bin/backup_cron.sh"
touchCmd := exec.Command("touch", backupCronFile)
@@ -54,6 +51,11 @@ bkup backup --dbname %s --port %s %v
}
touchLogCmd := exec.Command("touch", cronLogFile)
if err := touchLogCmd.Run(); err != nil {
utils.Fatalf("Error creating file %s: %v\n", cronLogFile, err)
}
cronJob := "/etc/cron.d/backup_cron"
touchCronCmd := exec.Command("touch", cronJob)
if err := touchCronCmd.Run(); err != nil {