1
0
Fork 0
mirror of https://github.com/miniflux/v2.git synced 2025-06-27 16:36:00 +00:00

Add the possibility to run cleanup tasks from the command line

This commit is contained in:
Frédéric Guillot 2023-06-25 11:23:23 -07:00
parent 3dc8e5ebaf
commit 5550d662a2
9 changed files with 138 additions and 116 deletions

View file

@ -17,7 +17,7 @@ import (
)
const (
flagInfoHelp = "Show application information"
flagInfoHelp = "Show build information"
flagVersionHelp = "Show application version"
flagMigrateHelp = "Run SQL migrations"
flagFlushSessionsHelp = "Flush all sessions (disconnect users)"
@ -28,7 +28,8 @@ const (
flagConfigFileHelp = "Load configuration file"
flagConfigDumpHelp = "Print parsed configuration values"
flagHealthCheckHelp = `Perform a health check on the given endpoint (the value "auto" try to guess the health check endpoint).`
flagCronjobHelp = "Run Miniflux as a cronjob to refresh a batch of feeds and exit"
flagRefreshFeedsHelp = "Refresh a batch of feeds and exit"
flagRunCleanupTasksHelp = "Run cleanup tasks (delete old sessions and archives old entries)"
)
// Parse parses command line arguments.
@ -46,7 +47,8 @@ func Parse() {
flagConfigFile string
flagConfigDump bool
flagHealthCheck string
flagCronjob bool
flagRefreshFeeds bool
flagRunCleanupTasks bool
)
flag.BoolVar(&flagInfo, "info", false, flagInfoHelp)
@ -63,7 +65,8 @@ func Parse() {
flag.StringVar(&flagConfigFile, "c", "", flagConfigFileHelp)
flag.BoolVar(&flagConfigDump, "config-dump", false, flagConfigDumpHelp)
flag.StringVar(&flagHealthCheck, "healthcheck", "", flagHealthCheckHelp)
flag.BoolVar(&flagCronjob, "cronjob", false, flagCronjobHelp)
flag.BoolVar(&flagRefreshFeeds, "refresh-feeds", false, flagRefreshFeedsHelp)
flag.BoolVar(&flagRunCleanupTasks, "run-cleanup-tasks", false, flagRunCleanupTasksHelp)
flag.Parse()
cfg := config.NewParser()
@ -190,8 +193,13 @@ func Parse() {
createAdmin(store)
}
if flagCronjob {
runCronjob(store)
if flagRefreshFeeds {
refreshFeeds(store)
return
}
if flagRunCleanupTasks {
runCleanupTasks(store)
return
}