403Webshell
Server IP : 61.19.30.66  /  Your IP : 216.73.216.15
Web Server : Apache/2.2.22 (Ubuntu)
System : Linux klw 3.11.0-15-generic #25~precise1-Ubuntu SMP Thu Jan 30 17:39:31 UTC 2014 x86_64
User : www-data ( 33)
PHP Version : 5.3.10-1ubuntu3.48
Disable Function : 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,
MySQL : ON  |  cURL : OFF  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : ON  |  Pkexec : OFF
Directory :  /usr/bin/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /usr/bin/byobu-status
#!/bin/sh
#
#    byobu-status: byobu's cached status gathering
#
#    Copyright (C) 2011 Dustin Kirkland
#
#    Authors: Dustin Kirkland <kirkland@ubuntu.com>
#
#    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/>.

PKG="byobu"
[ -r "$HOME/.byoburc" ] && . "$HOME/.byoburc"
[ -z "${BYOBU_PREFIX}" ] && export BYOBU_PREFIX="/usr" || export BYOBU_PREFIX
. "${BYOBU_PREFIX}/lib/${PKG}/include/common"

# Make sure status is not disabled
[ -f "$BYOBU_CONFIG_DIR/status.disable" ] && exit 0

# Clean and create cache directories
[ -d "$BYOBU_RUN_DIR/status.$BYOBU_BACKEND" ] || mkdir -p "$BYOBU_RUN_DIR/status.$BYOBU_BACKEND"
[ -d "$BYOBU_RUN_DIR/.last.$BYOBU_BACKEND" ] || mkdir -p "$BYOBU_RUN_DIR/.last.$BYOBU_BACKEND"

# Source configurations
for i in "${BYOBU_PREFIX}/share/$PKG/status/status" "${BYOBU_PREFIX}/share/$PKG/status/statusrc" "$BYOBU_CONFIG_DIR/status" "$BYOBU_CONFIG_DIR/statusrc" "$BYOBU_CONFIG_DIR/color" "$BYOBU_CONFIG_DIR/color.tmux"; do
	[ -r "$i" ] && . "$i"
done

case "$BYOBU_BACKEND" in
	screen)
		# Reload profile, if necessary
		if [ -e "/var/run/screen/S-$USER/$PKG.reload-required" ] || [ -e "$BYOBU_RUN_DIR/reload-required" ]; then
			if [ -r "$BYOBU_CONFIG_DIR/profile" ]; then
				# If the forced janitorial steps succeed, try a profile reload
				byobu-janitor --force && screen -X at 0 source "$BYOBU_CONFIG_DIR/profile" >/dev/null 2>&1
			fi
		fi
	;;
	tmux)
		# Do first-run procedures, if necessary
		if [ -n "$TMUX" ]; then
			if [ ! -e "$BYOBU_RUN_DIR/${TMUX#*,}" ]; then
				# Clear initial window name
				tmux rename-window ""
				touch "$BYOBU_RUN_DIR/${TMUX#*,}"
			fi
		fi
	;;
esac

# Get the current timestamp
get_now; NOW=${_RET}

get_status() {
	local cachepath="$BYOBU_RUN_DIR/status.$BYOBU_BACKEND/$1"
	local lastpath="$BYOBU_RUN_DIR/.last.$BYOBU_BACKEND/$1"
	local lastrun=0
	[ -r "$lastpath" ] && read lastrun < "$lastpath"
	case "$1" in
		ip_address4)
			local IPV6=0
			local function="ip_address"
		;;
		ip_address6)
			local IPV6=1
			local function="ip_address"
		;;
		*)
			local function="$1"
		;;
	esac
	status_freq "$function"
	local expiry=$(($lastrun+$_RET))
	find_script "$function" && . "${_RET}"
	# Update cache now, if necessary
	if [ $NOW -ge $expiry ] || [ "$lastrun" = "0" ]; then
		"__$function" > "$cachepath".new
	fi
	# Check if we have data in the cache
	if [ -s "$cachepath".new ]; then
		# Looks like we have an updated cache, use it
		mv -f "$cachepath".new "$cachepath"
		printf "%s" "$NOW" > "$lastpath"
		IFS= read line < "$cachepath"; printf "%s" "$line"
	elif [ -s "$cachepath" ]; then
		# New cache is empty, but we have data from our last run, use it
		IFS= read line < "$cachepath"; printf "%s" "$line"
	fi
}

case "$1" in
	*left|*right)
		eval items="\$$1"
		for i in $items; do
			case "$i" in \#*) continue ;; esac
			get_status "$i"
		done
	;;
	--detail)
		VER=
		if command -v dpkg-query >/dev/null; then
			VER=$(set -- $(dpkg-query --show $PKG); printf "%s\n" "$2")
		fi
		printf "$PKG-$VER Detailed Status Navigation\n"
		if command -v vim >/dev/null && `vim --version | grep -q +folding`; then
			printf "  Expand all - zr\t\tCollapse all - zm\n  Expand one - zo\t\tCollapse one - zc\n\n"
		fi
		for i in "$BYOBU_PREFIX/lib/$PKG"/*; do
			[ -f "$i" ] || continue
			i=${i##*/}
			case "$i" in
				include|menu|notify_osd|time_binary) continue ;;
			esac
			find_script "$i" && . "${_RET}"
			short=$(eval "__${i}" | $BYOBU_SED -e 's/^\s*//' -e 's/\s*$//' -e 's/.{[^}]*}//g')
			detail=$(eval "__${i}_detail" 2>/dev/null | $BYOBU_SED -e '/^$/d' -e 's/^/\t/g')
			printf "%s\n\t(%s)\n" "$short" "$i"
			[ -n "$detail" ] && printf "%s\n" "$detail"
		done
	;;
	color)
		[ -z "$FOREGROUND" ] && FOREGROUND="w"
		[ -z "$BACKGROUND" ] && BACKGROUND="k"
		printf "$ESC{= $BACKGROUND$FOREGROUND}"
	;;
esac

Youez - 2016 - github.com/yon3zu
LinuXploit