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:
parent
7b8495e2a8
commit
43beebc3ae
5 changed files with 7 additions and 16 deletions
|
@ -11,5 +11,4 @@ services:
|
|||
- "TZ=Europe/Paris"
|
||||
- "LOG_LEVEL=info"
|
||||
- "LOG_JSON=false"
|
||||
- "RUN_STARTUP=false"
|
||||
restart: always
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue