0
0
Fork 0
mirror of https://github.com/crazy-max/diun.git synced 2025-03-16 20:33:30 +00:00

Always run on startup

This commit is contained in:
CrazyMax 2019-07-01 00:15:06 +02:00
parent 7b8495e2a8
commit 43beebc3ae
No known key found for this signature in database
GPG key ID: 3248E46B6BB8C7F7
5 changed files with 7 additions and 16 deletions

View file

@ -11,5 +11,4 @@ services:
- "TZ=Europe/Paris"
- "LOG_LEVEL=info"
- "LOG_JSON=false"
- "RUN_STARTUP=false"
restart: always

View file

@ -70,7 +70,6 @@ Flags:
--log-level="info" Set log level.
--log-json Enable JSON logging output.
--log-caller Enable to add file:line of the caller.
--run-startup Run on startup.
--docker Enable Docker mode.
--version Show application version.
```
@ -86,7 +85,6 @@ Flags:
* `--log-level <level>` : Log level output. _Optional_. (default: `info`).
* `--log-json` : Enable JSON logging output. _Optional_. (default: `false`).
* `--log-caller` : Enable to add file:line of the caller. _Optional_. (default: `false`).
* `--run-startup` : Run on startup. _Optional_. (default: `false`).
## Configuration
@ -221,7 +219,6 @@ Environment variables can be used within your container :
* `LOG_LEVEL` : Log level output (default `info`)
* `LOG_JSON`: Enable JSON logging output (default `false`)
* `LOG_CALLER`: Enable to add file:line of the caller (default `false`)
* `RUN_STARTUP`: Run on startup (default `false`)
Docker compose is the recommended way to run this image. Copy the content of folder [.res/compose](.res/compose) in `/opt/diun/` on your host for example. Edit the compose and config file with your preferences and run the following commands :
@ -237,7 +234,6 @@ $ docker run -d --name diun \
-e "TZ=Europe/Paris" \
-e "LOG_LEVEL=info" \
-e "LOG_JSON=false" \
-e "RUN_STARTUP=false" \
-v "$(pwd)/data:/data" \
-v "$(pwd)/diun.yml:/diun.yml:ro" \
crazymax/diun:latest

View file

@ -30,7 +30,6 @@ func main() {
kingpin.Flag("log-level", "Set log level.").Envar("LOG_LEVEL").Default("info").StringVar(&flags.LogLevel)
kingpin.Flag("log-json", "Enable JSON logging output.").Envar("LOG_JSON").Default("false").BoolVar(&flags.LogJson)
kingpin.Flag("log-caller", "Enable to add file:line of the caller.").Envar("LOG_CALLER").Default("false").BoolVar(&flags.LogCaller)
kingpin.Flag("run-startup", "Run on startup.").Envar("RUN_STARTUP").Default("false").BoolVar(&flags.RunStartup)
kingpin.Flag("docker", "Enable Docker mode.").Envar("DOCKER").Default("false").BoolVar(&flags.Docker)
kingpin.UsageTemplate(kingpin.CompactUsageTemplate).Version(version).Author("CrazyMax")
kingpin.CommandLine.Name = "diun"

View file

@ -53,9 +53,7 @@ func (di *Diun) Start() error {
var err error
// Run on startup
if di.cfg.Flags.RunStartup {
di.Run()
}
di.Run()
// Init scheduler
di.jobID, err = di.cron.AddJob(di.cfg.Watch.Schedule, di)

View file

@ -2,11 +2,10 @@ package model
// Flags holds flags from command line
type Flags struct {
Cfgfile string
Timezone string
LogLevel string
LogJson bool
LogCaller bool
RunStartup bool
Docker bool
Cfgfile string
Timezone string
LogLevel string
LogJson bool
LogCaller bool
Docker bool
}