Created
December 31, 2022 14:37
-
-
Save C0rporeus/ba607e001356051e3b7304d6eb464ff8 to your computer and use it in GitHub Desktop.
Script for install bundles in remote server for JbossFuse
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# insert bundle name and password to connect to remote server | |
echo "Ingrese el nombre del bundle: " | |
read bundle_name | |
echo "Ingrese la contraseña para la conexión SSH: " | |
read -s password | |
# connect to remote server and install bundle whit expect (install expect before use this script) | |
expect -c " | |
spawn ssh -o PasswordAuthentication=yes user@server 'bundle_list=$(osgi:list); bundle_id=$(echo "$bundle_list" | grep "$bundle_name" | awk "{print $1}")' | |
expect \"*?assword:*\" | |
send \"$password\r\" | |
interact | |
" | |
# verify if bundle is installed correctly in list of bundles previously installed | |
if grep -q "$bundle_name" <<< "$bundle_list"; then | |
# message to show if bundle is installed correctly | |
echo "El bundle se ha instalado correctamente" | |
else | |
# message to show if bundle is not installed correctly | |
echo "Error al instalar el bundle" | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment