2022-04-09 09:46:07 +02:00
|
|
|
module cron
|
|
|
|
|
|
|
|
import git
|
2022-04-10 16:17:50 +02:00
|
|
|
import time
|
2022-04-13 15:24:55 +02:00
|
|
|
import log
|
|
|
|
import util
|
|
|
|
import cron.daemon
|
2022-04-09 09:46:07 +02:00
|
|
|
|
2022-04-12 21:23:38 +02:00
|
|
|
// cron starts a cron daemon & starts periodically scheduling builds.
|
2022-04-09 09:46:07 +02:00
|
|
|
pub fn cron(conf Config) ? {
|
2022-04-13 15:24:55 +02:00
|
|
|
// Configure logger
|
|
|
|
log_level := log.level_from_tag(conf.log_level) or {
|
|
|
|
util.exit_with_message(1, 'Invalid log level. The allowed values are FATAL, ERROR, WARN, INFO & DEBUG.')
|
|
|
|
}
|
|
|
|
|
|
|
|
mut logger := log.Log{
|
|
|
|
level: log_level
|
|
|
|
}
|
|
|
|
|
|
|
|
logger.set_full_logpath(conf.log_file)
|
|
|
|
logger.log_to_console_too()
|
|
|
|
|
|
|
|
d := daemon.init(conf)
|
2022-04-09 09:46:07 +02:00
|
|
|
}
|