diff --git a/Containerfile b/Containerfile index 42eb63b..1155cbf 100644 --- a/Containerfile +++ b/Containerfile @@ -32,6 +32,7 @@ RUN mkdir -p /data/vids COPY <<-EOT /data/config.toml dry_run = false out_dir = "/data/vids" + daemon = true [provider] [provider.youtube] diff --git a/README.md b/README.md index c88a68a..11106e1 100644 --- a/README.md +++ b/README.md @@ -72,6 +72,7 @@ Full `config.toml`: ```toml dry_run = true # set to `false` for real run out_dir = "./vids" # path to archive vids +daemon = true # true to run scheduler, false to run once [provider] [provider.youtube] diff --git a/internal/config/config.go b/internal/config/config.go index ccfd3e8..9b271b7 100644 --- a/internal/config/config.go +++ b/internal/config/config.go @@ -25,6 +25,7 @@ type Config struct { Out_dir string Provider map[string]Provider Dry_run bool + Daemon bool } func Load(filepath string) (Config, error) { diff --git a/main.go b/main.go index 45b1228..7429c26 100644 --- a/main.go +++ b/main.go @@ -58,6 +58,12 @@ func main() { panic(err) } - s := scheduler.Scheduler{} - s.Start(run, cfg) + if cfg.Daemon { + log.Println("running with scheduler") + s := scheduler.Scheduler{} + s.Start(run, cfg) + } else { + log.Println("running standalone") + run(cfg) + } }