mirror of
https://github.com/iv-org/invidious.git
synced 2025-09-24 06:34:41 -04:00
forgot a file
This commit is contained in:
parent
1619e78d6c
commit
d9b9cc0d7c
1 changed files with 23 additions and 0 deletions
23
src/invidious/helpers/loadavg.cr
Normal file
23
src/invidious/helpers/loadavg.cr
Normal file
|
@ -0,0 +1,23 @@
|
||||||
|
class Invidious::Loadavg
|
||||||
|
|
||||||
|
def self.get_loadavg
|
||||||
|
|
||||||
|
str_loadavg = "error"
|
||||||
|
|
||||||
|
if CONFIG.loadavg_enabled
|
||||||
|
|
||||||
|
# get the uptime
|
||||||
|
loadavg_cmd = "/usr/bin/cat /proc/loadavg | awk -F'[ ]' '{print $1\" \"$2\" \"$3}'"
|
||||||
|
loadavg_args = ""
|
||||||
|
process = Process.new(loadavg_cmd, [loadavg_args], output: Process::Redirect::Pipe)
|
||||||
|
str_loadavg = process.output.gets_to_end
|
||||||
|
|
||||||
|
else
|
||||||
|
str_loadavg = ""
|
||||||
|
end
|
||||||
|
|
||||||
|
return str_loadavg
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
Loading…
Add table
Add a link
Reference in a new issue