diff options
author | Javier Sepulveda <javier.sepulveda@uv.es> | 2023-04-18 09:47:55 +0200 |
---|---|---|
committer | Javier Sepulveda <javier.sepulveda@uv.es> | 2023-04-18 09:47:55 +0200 |
commit | 42fedf1f2c0fd0880bba0d5d90693b5a37287471 (patch) | |
tree | 84bfb9d7da666e477bb5c9faa8c205c25d86e452 | |
parent | 439b363852287b218b497c3362f342bfb4c7d219 (diff) | |
download | deployment-42fedf1f2c0fd0880bba0d5d90693b5a37287471.tar.gz deployment-42fedf1f2c0fd0880bba0d5d90693b5a37287471.tar.bz2 deployment-42fedf1f2c0fd0880bba0d5d90693b5a37287471.zip |
shfmt + restart journald + user prompt continue installation
-rwxr-xr-x | netzbon/check-distro.sh | 28 | ||||
-rwxr-xr-x | netzbon/check-services.sh | 51 | ||||
-rwxr-xr-x | netzbon/config_journald.sh | 6 |
3 files changed, 38 insertions, 47 deletions
diff --git a/netzbon/check-distro.sh b/netzbon/check-distro.sh index 4eb7b64..ab91591 100755 --- a/netzbon/check-distro.sh +++ b/netzbon/check-distro.sh @@ -2,23 +2,23 @@ DISTRO=$(hostnamectl | grep 'Operating System' | cut -d ' ' -f 3-) -echo $DISTRO +echo "$DISTRO" COUNT=$(grep -c "$DISTRO" distros-supported.txt) -echo $COUNT +echo "$COUNT" + +GOON="n" if [[ $COUNT -ne 1 ]]; then - echo "Distro not supported" - echo "Please check distro list ..." - sleep 10 - exit 1 -else - echo "Your distro is supported. Installation can continue ..." - sleep 3 + echo "Your distro or distro release, is not supported." + echo "Please check distros-supported.txt." + read -r -p "Do you want to continue in any case, answer: y/n ? " GOON + if [[ $GOON = 'y' ]]; then + echo "Retaking installation ..." + else + echo "Existing installation..." + sleep 2 + exit 1 + fi fi - - - - - diff --git a/netzbon/check-services.sh b/netzbon/check-services.sh index cc1105d..de77882 100755 --- a/netzbon/check-services.sh +++ b/netzbon/check-services.sh @@ -3,21 +3,19 @@ # Source problem, check if the needed services are up. # Function to check each service status, if down, restart once -function check_service() -{ +function check_service() { -STATUS="$(systemctl show -p SubState $1 | cut -d'=' -f2)" + STATUS="$(systemctl show -p SubState $1 | cut -d'=' -f2)" -if [ "${STATUS}" != "running" ]; then - echo "Service $1 is down. Restarting it now ..." - systemctl restart ${1} -else - echo "Service $1 running okay" -fi + if [ "${STATUS}" != "running" ]; then + echo "Service $1 is down. Restarting it now ..." + systemctl restart ${1} + else + echo "Service $1 running okay" + fi } - #All services list #System @@ -27,9 +25,9 @@ declare -a services_system=("nginx" "postgresql@14-main") declare -a services_libeufin=("libeufin-nexus" "libeufin-sandbox") #Exchange -declare -a services_exchange=("taler-exchange-aggregator" "taler-exchange-closer" "taler-exchange-httpd" -"taler-exchange-secmod-cs" "taler-exchange-secmod-eddsa" "taler-exchange-secmod-rsa" -"taler-exchange-secmod-rsa" "taler-exchange-transfer" "taler-exchange-wirewatch") +declare -a services_exchange=("taler-exchange-aggregator" "taler-exchange-closer" "taler-exchange-httpd" + "taler-exchange-secmod-cs" "taler-exchange-secmod-eddsa" "taler-exchange-secmod-rsa" + "taler-exchange-secmod-rsa" "taler-exchange-transfer" "taler-exchange-wirewatch") #Merchant declare -a services_merchant=("taler-merchant-httpd") @@ -38,35 +36,24 @@ declare -a services_merchant=("taler-merchant-httpd") # System -for i in "${services_system[@]}" -do - check_service $i +for i in "${services_system[@]}"; do + check_service $i done # Libeufin -for i in "${services_libeufin[@]}" -do - check_service $i +for i in "${services_libeufin[@]}"; do + check_service $i done # Exchange -for i in "${services_exchange[@]}" -do - check_service $i +for i in "${services_exchange[@]}"; do + check_service $i done # Merchant -for i in "${services_merchant[@]}" -do - check_service $i +for i in "${services_merchant[@]}"; do + check_service $i done - - - - - - - diff --git a/netzbon/config_journald.sh b/netzbon/config_journald.sh index d9399d8..0cdbca4 100755 --- a/netzbon/config_journald.sh +++ b/netzbon/config_journald.sh @@ -2,9 +2,13 @@ mkdir -p /etc/systemd/journald.conf.d/ -cat <<EOF > /etc/systemd/journald.conf.d/netzbon.conf +cat <<EOF >/etc/systemd/journald.conf.d/netzbon.conf [Journal] Storage=persistent MaxFileSec=1week Compress=yes EOF + +# Restart journald service to apply configurations + +systemctl restart systemd-journald.service |