14 lines
343 B
Bash
Executable File
14 lines
343 B
Bash
Executable File
#!/bin/sh
|
|
|
|
printf "Content-type: application/json\n"
|
|
printf "\n"
|
|
|
|
printf '{"hostname": "%s", "uptime": "%s", "since": "%s", "users": "%s"}\n' \
|
|
"$(hostname)" \
|
|
"$(uptime | sed -e "s/.* up *//" -e "s/ *days, */d/" -e "s/:/h/" -e "s/,.*/m/")" \
|
|
"$(uptime -s)" \
|
|
"$(who | grep -v tmux | cut -d' ' -f1 | sort -u | wc -l)"
|
|
|
|
exit 0
|
|
|