diff --git a/src/invidious/helpers/loadavg.cr b/src/invidious/helpers/loadavg.cr new file mode 100644 index 00000000..7b342ecb --- /dev/null +++ b/src/invidious/helpers/loadavg.cr @@ -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 \ No newline at end of file