checker: Can call checker with a list of students to one-check

This commit is contained in:
nemunaire 2021-10-31 18:16:58 +01:00
parent a241aebcb4
commit 840d58e8b0
2 changed files with 243 additions and 222 deletions

View file

@ -33,6 +33,24 @@ func main() {
log.Fatal("Cannot create database: ", err)
}
if len(flag.Args()) >= 1 {
// Check one or more students and exit
for _, std_login := range flag.Args() {
if verbose {
log.Println("==============================\n")
}
if std, err := adlin.GetStudentByLogin(std_login); err != nil {
log.Printf("%s: %s", std_login, err.Error())
} else {
log.Printf("Checking %s...", std.Login)
studentChecker(std, true)
}
}
return
}
// Prepare graceful shutdown
interrupt := make(chan os.Signal, 1)
signal.Notify(interrupt, os.Interrupt, syscall.SIGTERM)
@ -51,5 +69,4 @@ loop:
studentsChecker()
}
}
}