|
|
|
@ -91,10 +91,6 @@ type Config struct { |
|
|
|
|
ZfssyncLogDir string `ini:"zfssync_logs_dir"` |
|
|
|
|
// path to the unix socket for arthur to use for communication
|
|
|
|
|
SockPath string `ini:"sock_path"` |
|
|
|
|
// // TODO: add dry run (default: false)
|
|
|
|
|
// DryRun bool `ini:"dry_run"`
|
|
|
|
|
// // TODO: add setting for verbosity (default: false)
|
|
|
|
|
// Verbose bool `ini:"verbose"`
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
type Repo struct { |
|
|
|
@ -106,6 +102,8 @@ type Repo struct { |
|
|
|
|
FrequencyStr string `ini:"frequency"` |
|
|
|
|
// the desired interval (in seconds) between successive runs
|
|
|
|
|
Frequency int `ini:"-"` |
|
|
|
|
// instead of spawning a process sleep for 50 seconds instead (default: false)
|
|
|
|
|
DryRun bool `ini:"dry_run"` |
|
|
|
|
// the maximum time (in seconds) that each child process of this repo
|
|
|
|
|
// can for before being killed
|
|
|
|
|
MaxTime int `ini:"max_time"` |
|
|
|
@ -134,6 +132,8 @@ type Repo struct { |
|
|
|
|
RsyncLogFile string `ini:"-"` |
|
|
|
|
// full file path for file logging this repo's zfssync
|
|
|
|
|
ZfssyncLogFile string `ini:"-"` |
|
|
|
|
// add the "-vv" flag to rsync commands and enable the Debug log (default: false)
|
|
|
|
|
Verbose bool `ini:"verbose"` |
|
|
|
|
// the repo will write its name and status in a Result struct to DoneChan
|
|
|
|
|
// when it has finished a job (shared by all repos)
|
|
|
|
|
DoneChan chan<- SyncResult `ini:"-"` |
|
|
|
@ -224,6 +224,7 @@ func LoadConfig(configPath string, doneChan chan SyncResult, stopChan chan struc |
|
|
|
|
Name: repoName, |
|
|
|
|
SyncType: newConf.DefaultSyncType, |
|
|
|
|
FrequencyStr: newConf.DefaultFrequencyStr, |
|
|
|
|
DryRun: false, |
|
|
|
|
MaxTime: newConf.DefaultMaxTime, |
|
|
|
|
MaxRsyncIO: newConf.DefaultMaxRsyncIO, |
|
|
|
|
LocalDir: repoName, |
|
|
|
@ -231,6 +232,7 @@ func LoadConfig(configPath string, doneChan chan SyncResult, stopChan chan struc |
|
|
|
|
RepoLogFile: filepath.Join(newConf.RepoLogDir, repoName) + ".log", |
|
|
|
|
RsyncLogFile: filepath.Join(newConf.RsyncLogDir, repoName) + "-rsync.log", |
|
|
|
|
ZfssyncLogFile: filepath.Join(newConf.ZfssyncLogDir, repoName) + "-zfssync.log", |
|
|
|
|
Verbose: false, |
|
|
|
|
DoneChan: doneChan, |
|
|
|
|
StopChan: stopChan, |
|
|
|
|
} |
|
|
|
@ -267,7 +269,7 @@ func LoadConfig(configPath string, doneChan chan SyncResult, stopChan chan struc |
|
|
|
|
) |
|
|
|
|
|
|
|
|
|
// create the logger and load the state
|
|
|
|
|
repo.Logger = logger.NewLogger(repo.Name, repo.RepoLogFile) |
|
|
|
|
repo.Logger = logger.NewLogger(repo.Name, repo.RepoLogFile, repo.Verbose) |
|
|
|
|
repo.State = &RepoState{ |
|
|
|
|
IsRunning: false, |
|
|
|
|
LastAttemptStartTime: 0, |
|
|
|
|