add internal server error for some errors
This commit is contained in:
parent
2b3b221baf
commit
b8c03015ef
8
main.go
8
main.go
@ -106,17 +106,19 @@ func main() {
|
|||||||
}
|
}
|
||||||
// Get the number of users online
|
// Get the number of users online
|
||||||
usersonline, err := exec.Command("bash", "-c", "/usr/bin/users").Output()
|
usersonline, err := exec.Command("bash", "-c", "/usr/bin/users").Output()
|
||||||
|
if err != nil {
|
||||||
|
log.Error(err)
|
||||||
|
return c.SendStatus(fiber.StatusInternalServerError)
|
||||||
|
}
|
||||||
usersonlinestr := string(usersonline)
|
usersonlinestr := string(usersonline)
|
||||||
usersonlinededup := Dedup(usersonlinestr)
|
usersonlinededup := Dedup(usersonlinestr)
|
||||||
outputa := int(strings.Count(usersonlinededup, " "))
|
outputa := int(strings.Count(usersonlinededup, " "))
|
||||||
var output int
|
var output int
|
||||||
output = outputa + 1
|
output = outputa + 1
|
||||||
if err != nil {
|
|
||||||
log.Error(err)
|
|
||||||
}
|
|
||||||
users, err2 := exec.Command("bash", "-c", "/usr/bin/ls /home").Output()
|
users, err2 := exec.Command("bash", "-c", "/usr/bin/ls /home").Output()
|
||||||
if err2 != nil {
|
if err2 != nil {
|
||||||
log.Error(err2)
|
log.Error(err2)
|
||||||
|
return c.SendStatus(fiber.StatusInternalServerError)
|
||||||
}
|
}
|
||||||
userstr := string(users)
|
userstr := string(users)
|
||||||
userstr2 := strings.TrimSuffix(userstr, "\n")
|
userstr2 := strings.TrimSuffix(userstr, "\n")
|
||||||
|
Loading…
Reference in New Issue
Block a user