You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: backup.go
    path of file: ./repos/chainlink/core/services/periodicbackup
    
    the code of the file until where you have to start completion: package periodicbackup

import (
	"context"
	"fmt"
	"net/url"
	"os"
	"os/exec"
	"path/filepath"
	"time"

	"github.com/pkg/errors"

	"github.com/smartcontractkit/chainlink-common/pkg/services"

	"gith
    
func NewDatabaseBackup(dbUrl url.URL, rootDir string, backupConfig BackupConfig, lggr logger.Logger) (DatabaseBackup, error) {
	lggr = lggr.Named("DatabaseBackup")
	dbBackupUrl := backupConfig.URL()
	if dbBackupUrl != nil {
		dbUrl = *dbBackupUrl
	}

	outputParentDir := filepath.Join(rootDir, "backup")
	if backupConfig.Dir() != "" {
		dir, err := filepath.Abs(backupConfig.Dir())
		if err != nil {
			return nil, errors.Errorf("failed to get path for Database.Backup.Dir (%s) - please set it to a valid directory path", backupConfig.Dir())
		}
		outputParentDir = dir
	}

	return &databaseBackup{
		services.StateMachine{},
		lggr,
		dbUrl,
		backupConfig.Mode(),
		backupConfig.Frequency(),
		outputParentDir,
		make(chan bool),
	}, nil
}