403Webshell
Server IP : www.new.bangkokfinder.com  /  Your IP : 104.23.176.9
Web Server : nginx/1.20.1
System : Linux new 4.15.0-159-generic #167-Ubuntu SMP Tue Sep 21 08:55:05 UTC 2021 x86_64
User : bangkokfinder ( 1000)
PHP Version : 7.4.33
Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare,
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : ON  |  Pkexec : ON
Directory :  /proc/thread-self/root/etc/init.d/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /proc/thread-self/root/etc/init.d/datadog-agent-trace
#!/bin/sh

### BEGIN INIT INFO
# Provides: datadog-agent-trace
# Short-Description: Start and stop datadog trace agent
# Description: Datadog Trace Agent (APM)
# Required-Start: $remote_fs
# Required-Stop: $remote_fs
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
### END INIT INFO

. /lib/lsb/init-functions

ETC_DIR="/etc/datadog-agent"
INSTALL_DIR="/opt/datadog-agent"
AGENTPATH="$INSTALL_DIR/embedded/bin/trace-agent"
PIDFILE="$INSTALL_DIR/run/trace-agent.pid"
AGENT_ARGS="--config=$ETC_DIR/datadog.yaml --pid=$PIDFILE"
AGENT_USER="dd-agent"
NAME="datadog-agent-trace"
DESC="Datadog Trace Agent (APM)"



if [ ! -x $AGENTPATH ]; then
	echo "$AGENTPATH not found. Exiting."
	exit 0
fi

if [ -r "/etc/default/${NAME}" ]; then
	. "/etc/default/${NAME}"
fi


#
# Function that starts the daemon/service
#
do_start()
{
	# Return
	#   0 if daemon has been started
	#   1 if daemon was already running
	#   2 if daemon could not be started
	start-stop-daemon --start --test --quiet --pidfile $PIDFILE --user $AGENT_USER --startas $AGENTPATH > /dev/null \
		|| return 1
	start-stop-daemon --start --background --chuid $AGENT_USER --quiet --pidfile $PIDFILE --user $AGENT_USER --startas $AGENTPATH -- \
		$AGENT_ARGS \
		|| return 2
	# Add code here, if necessary, that waits for the process to be ready
	# to handle requests from services started subsequently which depend
	# on this one.  As a last resort, sleep for some time.
}


#
# Start the agent and wait for it to be up
#
start_and_wait()
{
	log_daemon_msg "Starting $DESC" "$NAME"
	do_start
	case "$?" in
		1) log_end_msg 0 ;;
		2) log_end_msg 1 ;;
		*)
			# check if the agent is running once per second for 5 seconds
			retries=5
			while [ $retries -gt 1 ]; do
				start-stop-daemon --start --test --quiet --pidfile $PIDFILE --user $AGENT_USER --startas $AGENTPATH
				if [ "$?" -eq "1" ]; then
					# We've started up successfully. Exit cleanly
					log_end_msg 0
					return 0
				else
					retries=$(($retries - 1))
					sleep 1
				fi
			done
			# After 5 tries the agent didn't start. Report an error
			log_end_msg 1

		;;
	esac
}

#
# Function that stops the daemon/service
#
do_stop()
{
	# Return
	#   0 if daemon has been stopped
	#   1 if daemon was already stopped
	#   2 if daemon could not be stopped
	#   other if a failure occurred
	start-stop-daemon --stop --quiet --retry=30 --pidfile $PIDFILE --user $AGENT_USER --startas $AGENTPATH
	RETVAL="$?"
	rm -f $PIDFILE
	return $RETVAL
}

#
# Stop the agent and wait for it to be down
#
stop_and_wait()
{
	log_daemon_msg "Stopping $DESC" "$NAME"
	do_stop
	case "$?" in
		0|1) log_end_msg 0 ;;
		*) log_end_msg 1 ;; # Failed to stop
	esac
}

# Action to take
case "$1" in
	start)
		if init_is_upstart; then
			exit 1
		fi
		if [ "$DATADOG_ENABLED" = "no" ]; then
			echo "Disabled via /etc/default/$NAME. Exiting."
			exit 0
		fi

		start_and_wait

			;;

	stop)
		if init_is_upstart; then
			exit 0
		fi

		stop_and_wait

		;;

	status)
		status_of_proc -p $PIDFILE $AGENTPATH $NAME && exit 0 || exit $?
		;;

	restart|force-reload)
		if init_is_upstart; then
			exit 1
		fi

		echo "Restarting $DESC"

		stop_and_wait
		start_and_wait

		;;

	*)
		N=/etc/init.d/$NAME
		echo "Usage: $N {start|stop|restart|status}"
		exit 1
		;;
esac

exit $?

Youez - 2016 - github.com/yon3zu
LinuXploit