update install agent shell
This commit is contained in:
parent
931ce17819
commit
fa3137bf83
|
@ -201,9 +201,9 @@ function install_certs() {
|
||||||
client_key="{{client_key}}"
|
client_key="{{client_key}}"
|
||||||
|
|
||||||
mkdir -p ${install_dir}/config
|
mkdir -p ${install_dir}/config
|
||||||
sh -c "echo '${ca_crt}' > ${install_dir}/config/ca.crt"
|
echo -e "${ca_crt}" > ${install_dir}/config/ca.crt
|
||||||
sh -c "echo '${client_crt}' > ${install_dir}/config/client.crt"
|
echo -e "${client_crt}" > ${install_dir}/config/client.crt
|
||||||
sh -c "echo '${client_key}' > ${install_dir}/config/client.key"
|
echo -e "${client_key}" > ${install_dir}/config/client.key
|
||||||
}
|
}
|
||||||
|
|
||||||
function install_config() {
|
function install_config() {
|
||||||
|
@ -247,22 +247,22 @@ function install_service() {
|
||||||
linux_svc=/etc/systemd/system/agent.service
|
linux_svc=/etc/systemd/system/agent.service
|
||||||
|
|
||||||
if [[ -f "$linux_svc" || -f "$macos_svc" ]]; then
|
if [[ -f "$linux_svc" || -f "$macos_svc" ]]; then
|
||||||
echo "service stop & uninstall for existing agent"
|
echo "[agent] waiting service stop & uninstall for existing agent"
|
||||||
$agent_svc -service stop &>/dev/null
|
$agent_svc -service stop &>/dev/null
|
||||||
$agent_svc -service uninstall &>/dev/null
|
$agent_svc -service uninstall &>/dev/null
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "seriver install & start"
|
echo "[agent] waiting service install & start"
|
||||||
$agent_svc -service install
|
$agent_svc -service install &>/dev/null
|
||||||
$agent_svc -service start
|
$agent_svc -service start &>/dev/null
|
||||||
sleep 5
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function register_agent() {
|
function register_agent() {
|
||||||
echo "Registration to INFINI Console"
|
|
||||||
console_endpoint="{{console_endpoint}}"
|
|
||||||
token={{token}}
|
token={{token}}
|
||||||
curl -XPOST -m9 -s ${console_endpoint}/agent/instance?token=${token}
|
console_endpoint="{{console_endpoint}}"
|
||||||
|
echo "[agent] waiting registering to INFINI Console"
|
||||||
|
__try curl -s --retry 5 --retry-delay 3 -m30 -XPOST -o /dev/null ${console_endpoint}/agent/instance?token=${token}
|
||||||
}
|
}
|
||||||
|
|
||||||
function main() {
|
function main() {
|
||||||
|
@ -271,7 +271,6 @@ function main() {
|
||||||
-u|--url) location="$2"; shift 2 ;;
|
-u|--url) location="$2"; shift 2 ;;
|
||||||
-v|--version) version="$2"; shift 2 ;;
|
-v|--version) version="$2"; shift 2 ;;
|
||||||
-t|--target) target_dir="$2"; shift 2 ;;
|
-t|--target) target_dir="$2"; shift 2 ;;
|
||||||
-p|--port) port="$2"; shift 2 ;;
|
|
||||||
*) print_usage ;;
|
*) print_usage ;;
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
|
|
Loading…
Reference in New Issue