From c386fb25782170d95f6e34da3e6f72e0307df21d Mon Sep 17 00:00:00 2001 From: Andrew Wang Date: Sat, 18 Jun 2022 20:22:06 +0000 Subject: [PATCH] add service file and minor changes --- merlin/config/config.go | 4 ++++ merlin/merlin-config.ini | 7 +++---- merlin/merlin-go.service | 13 +++++++++++++ merlin/sync/process.go | 2 +- 4 files changed, 21 insertions(+), 5 deletions(-) create mode 100644 merlin/merlin-go.service diff --git a/merlin/config/config.go b/merlin/config/config.go index 9cd0831..a06d494 100644 --- a/merlin/config/config.go +++ b/merlin/config/config.go @@ -91,6 +91,10 @@ 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 { diff --git a/merlin/merlin-config.ini b/merlin/merlin-config.ini index eadbccc..08d145e 100644 --- a/merlin/merlin-config.ini +++ b/merlin/merlin-config.ini @@ -1,5 +1,5 @@ -ipv4_address = 129.97.134.129 -ipv6_address = 2620:101:f000:4901:c5c::129 +ipv4_address = 129.97.134.71 +ipv6_address = 2620:101:f000:4901:c5c::f:1055 download_dir = /mirror/root trace_dir = /home/mirror-go/merlin/trace @@ -12,8 +12,7 @@ zfssync_logs_dir = /home/mirror-go/merlin/logs-zfssync sock_path = /mirror/merlin/run/merlin-go.sock [CPAN] -; sync_type = csc-sync-standard -sync_type = csc-sync-dummy +sync_type = csc-sync-standard frequency = twice-daily local_dir = CPAN rsync_host = cpan-rsync.perl.org diff --git a/merlin/merlin-go.service b/merlin/merlin-go.service new file mode 100644 index 0000000..71a649a --- /dev/null +++ b/merlin/merlin-go.service @@ -0,0 +1,13 @@ +[Unit] +Description=Manages synchronization of mirrored projects +After=network.target + +[Service] +ExecStart=/home/mirror/merlin-go/merlin /home/mirror/merlin-go/merlin-config.ini +WorkingDirectory=/home/mirror/merlin +User=mirror +Group=mirror +SyslogIdentifier=merlin-go + +[Install] +WantedBy=multi-user.target \ No newline at end of file diff --git a/merlin/sync/process.go b/merlin/sync/process.go index 82f43c1..b598005 100644 --- a/merlin/sync/process.go +++ b/merlin/sync/process.go @@ -16,7 +16,7 @@ import ( // It returns a channel through which a Cmd will be sent once it has finished, // or nil if it was unable to start a process. func spawnProcess(repo *config.Repo, args []string) (ch <-chan *exec.Cmd) { - repo.Logger.Debug("Running the command: %v", args) + repo.Logger.Debug(fmt.Sprintf("Running the command: %v", args)) cmd := exec.Command(args[0], args[1:]...) repo.Logger.Debug("Starting process")