#!/usr/bin/env bash
set -x
arch=`uname -m`
if [[ $arch == "x86_64" ]]; then
  arch="amd64"
fi
if [[ $arch == "aarch64" ]]; then
  arch="arm64"
fi
if [[ $arch == "armv7l" ]]; then
  arch="arm32"
fi
if [[ $arch == "armv8l" ]]; then
	arch="arm64"
fi
if [[ $arch == "aarch" ]]; then
	arch="arm32"
fi
# shellcheck disable=SC2046
pid="`pgrep ttrun.sh` `pgrep ttobserver` `pgrep ttmanager_${arch} ` `pgrep happ` `pgrep ipes` `pgrep ttagent`"
pid="${pid} `pgrep watcher` `pgrep network_proxy` `pgrep netbox_vapi` `pgrep by_agent_pro`"
kill -9 $pid
# shellcheck disable=SC2181
if [[ $? -eq 0 ]]; then
	echo "stop success"
	exit 0
else
	echo "stop fail"
fi
exit 3