From 550e110fbcc093dce4f419f0baacff9f8a0e29fc Mon Sep 17 00:00:00 2001 From: CanbiZ Date: Tue, 25 Jun 2024 14:16:01 +0200 Subject: [PATCH 1/8] Add new LXC: Scrutiny --- ct/scrutiny.sh | 189 ++++++++++++++++++++++++++++++++++++ install/scrutiny-install.sh | 164 +++++++++++++++++++++++++++++++ 2 files changed, 353 insertions(+) create mode 100644 ct/scrutiny.sh create mode 100644 install/scrutiny-install.sh diff --git a/ct/scrutiny.sh b/ct/scrutiny.sh new file mode 100644 index 00000000..431d9d62 --- /dev/null +++ b/ct/scrutiny.sh @@ -0,0 +1,189 @@ +#!/usr/bin/env bash +source <(curl -s https://raw.githubusercontent.com/MickLesk/Proxmox_DEV/main/misc/build.func) +# Copyright (c) 2021-2024 tteck +# Author: tteck +# Co-Author: MickLesk (Canbiz) +# License: MIT +# https://github.com/tteck/Proxmox/raw/main/LICENSE + +function header_info { +clear +cat <<"EOF" + _____ __ _ + / ___/____________ __/ /_(_)___ __ __ + \__ \/ ___/ ___/ / / / __/ / __ \/ / / / + ___/ / /__/ / / /_/ / /_/ / / / / /_/ / +/____/\___/_/ \__,_/\__/_/_/ /_/\__, / + /____/ +EOF +} +header_info +echo -e "Loading..." +APP="Scrutiny" +var_disk="4" +var_cpu="1" +var_ram="1024" +var_os="debian" +var_version="12" +variables +color +catch_errors + +function default_settings() { + CT_TYPE="1" + PW="" + CT_ID=$NEXTID + HN=$NSAPP + DISK_SIZE="$var_disk" + CORE_COUNT="$var_cpu" + RAM_SIZE="$var_ram" + BRG="vmbr0" + NET="dhcp" + GATE="" + APT_CACHER="" + APT_CACHER_IP="" + DISABLEIP6="no" + MTU="" + SD="" + NS="" + MAC="" + VLAN="" + SSH="no" + VERB="no" + echo_default +} + + +function update_script() { + if [[ ! -d /opt/scrutiny ]]; then + msg_error "No ${APP} Installation Found!" + exit + fi + + RELEASE=$(curl -s https://api.github.com/repos/AnalogJ/scrutiny/releases/latest | grep "tag_name" | awk '{print substr($2, 2, length($2)-3) }') + + UPD=$(whiptail --backtitle "Proxmox VE Helper Scripts" --title "Scrutiny Management" --radiolist --cancel-button Exit-Script "Spacebar = Select" 11 58 3 \ + "1" "Update Scrutiny to $RELEASE" ON \ + "2" "Start Scrutiny Webapp" OFF \ + "3" "Start Scrutiny Collector" OFF \ + 3>&1 1>&2 2>&3) + header_info + + if [ "$UPD" == "1" ]; then + if [[ "${RELEASE}" != "$(cat /opt/scrutiny_version.txt)" ]] || [[ ! -f /opt/scrutiny_version.txt ]]; then + + msg_info "Stopping all Scrutiny Services" + WEBAPP_ACTIVE=$(systemctl is-active scrutiny.service) + COLLECTOR_ACTIVE=$(systemctl is-active scrutiny_collector.service) + systemctl stop scrutiny.service scrutiny_collector.service + msg_ok "Stopped all Scrutiny Services" + + msg_info "Updating to ${RELEASE}" + cd /opt + rm -rf scrutiny_bak + mv scrutiny scrutiny_bak + mkdir -p /opt/scrutiny/web /opt/scrutiny/bin + wget -q -O /opt/scrutiny/bin/scrutiny-web-linux-amd64 "https://github.com/AnalogJ/scrutiny/releases/download/${RELEASE}/scrutiny-web-linux-amd64" + wget -q -O /opt/scrutiny/bin/scrutiny-collector-metrics-linux-amd64 "https://github.com/AnalogJ/scrutiny/releases/download/${RELEASE}/scrutiny-collector-metrics-linux-amd64" + wget -q -O /opt/scrutiny/web/scrutiny-web-frontend.tar.gz "https://github.com/AnalogJ/scrutiny/releases/download/${RELEASE}/scrutiny-web-frontend.tar.gz" + cd /opt/scrutiny/web && tar xvzf scrutiny-web-frontend.tar.gz --strip-components 1 -C . + chmod +x /opt/scrutiny/bin/scrutiny-web-linux-amd64 + chmod +x /opt/scrutiny/bin/scrutiny-collector-metrics-linux-amd64 + echo "${RELEASE}" > /opt/scrutiny_version.txt + msg_ok "Updated Scrutiny to $RELEASE" + + msg_info "Cleaning up" + rm -f /opt/scrutiny/web/scrutiny-web-frontend.tar.gz + msg_ok "Cleaned" + + if [ "$WEBAPP_ACTIVE" == "active" ]; then + msg_info "Starting Scrutiny Webapp Service" + systemctl start scrutiny.service + msg_ok "Started Scrutiny Webapp Service" + fi + + if [ "$COLLECTOR_ACTIVE" == "active" ]; then + msg_info "Starting Scrutiny Collector Service" + systemctl start scrutiny_collector.service + msg_ok "Started Scrutiny Collector Service" + fi + + msg_ok "Updated Successfully!\n" + else + msg_ok "No update required. ${APP} is already at ${RELEASE}" + fi + exit + fi + +if [ "$UPD" == "2" ]; then + msg_info "Checking for Scrutiny Webapp Service" + if systemctl list-units --full -all | grep -Fq 'scrutiny.service'; then + msg_info "Stopping Scrutiny Webapp Service" + systemctl stop scrutiny.service + msg_ok "Stopped Scrutiny Webapp Service" + else + msg_info "Scrutiny Webapp Service not found, creating..." + cat </etc/systemd/system/scrutiny.service +[Unit] +Description=Scrutiny - Hard Drive Monitoring and Webapp +After=network.target + +[Service] +Type=simple +ExecStart=/opt/scrutiny/bin/scrutiny-web-linux-amd64 start --config /opt/scrutiny/config/scrutiny.yaml +Restart=always +User=root + +[Install] +WantedBy=multi-user.target +EOF + systemctl enable -q scrutiny.service + msg_ok "Created Scrutiny Webapp Service" + fi + + msg_info "Starting Scrutiny Webapp Service" + systemctl start scrutiny.service + msg_ok "Started Scrutiny Webapp Service" + exit +fi + +if [ "$UPD" == "3" ]; then + msg_info "Checking for Scrutiny Collector Service" + if systemctl list-units --full -all | grep -Fq 'scrutiny_collector.service'; then + msg_info "Stopping Scrutiny Collector Service" + systemctl stop scrutiny_collector.service + msg_ok "Stopped Scrutiny Collector Service" + else + msg_info "Scrutiny Collector Service not found, creating..." + cat </etc/systemd/system/scrutiny_collector.service +[Unit] +Description=Scrutiny Collector +After=network.target + +[Service] +Type=simple +ExecStart=/opt/scrutiny/bin/scrutiny-collector-metrics-linux-amd64 run --api-endpoint "http://localhost:8080" +Restart=always +User=root + +[Install] +WantedBy=multi-user.target +EOF + systemctl enable -q scrutiny_collector.service + msg_ok "Created Scrutiny Collector Service" + fi + + msg_info "Starting Scrutiny Collector Service" + systemctl start scrutiny_collector.service + msg_ok "Started Scrutiny Collector Service" + exit +fi +} + +start +build_container +description + +msg_ok "Completed Successfully!\n" +echo -e "${APP} Setup should be reachable by going to the following URL. + ${BL}http://${IP}:8080${CL} \n" \ No newline at end of file diff --git a/install/scrutiny-install.sh b/install/scrutiny-install.sh new file mode 100644 index 00000000..349a9439 --- /dev/null +++ b/install/scrutiny-install.sh @@ -0,0 +1,164 @@ +#!/usr/bin/env bash + +# Copyright (c) 2021-2024 tteck +# Author: tteck +# Co-Author: MickLesk (Canbiz) +# License: MIT +# https://github.com/tteck/Proxmox/raw/main/LICENSE +# Source: https://github.com/AnalogJ/scrutiny + +source /dev/stdin <<<"$FUNCTIONS_FILE_PATH" +color +verb_ip6 +catch_errors +setting_up_container +network_check +update_os + +msg_info "Installing Dependencies" +$STD apt-get install -y \ + sudo \ + curl \ + smartmontools \ + make \ + mc +msg_ok "Installed Dependencies" + +msg_info "Installing Scrutiny WebApp" +mkdir -p /opt/scrutiny/config +mkdir -p /opt/scrutiny/web +mkdir -p /opt/scrutiny/bin +RELEASE=$(curl -s https://api.github.com/repos/analogj/scrutiny/releases/latest | grep "tag_name" | awk '{print substr($2, 2, length($2)-3) }') +echo "${RELEASE}" >/opt/scrutiny_version.txt +wget -q -O /opt/scrutiny/bin/scrutiny-web-linux-amd64 "https://github.com/AnalogJ/scrutiny/releases/download/${RELEASE}/scrutiny-web-linux-amd64" +wget -q -O /opt/scrutiny/web/scrutiny-web-frontend.tar.gz "https://github.com/AnalogJ/scrutiny/releases/download/${RELEASE}/scrutiny-web-frontend.tar.gz" +cd /opt/scrutiny/web && tar xzf scrutiny-web-frontend.tar.gz --strip-components 1 -C . +chmod +x /opt/scrutiny/bin/scrutiny-web-linux-amd64 +msg_ok "Installed Scrutiny WebApp" + +msg_info "Installing Scrutiny Collector" +wget -q -O /opt/scrutiny/bin/scrutiny-collector-metrics-linux-amd64 "https://github.com/AnalogJ/scrutiny/releases/download/${RELEASE}/scrutiny-collector-metrics-linux-amd64" +chmod +x /opt/scrutiny/bin/scrutiny-collector-metrics-linux-amd64 +msg_ok "Installed Scrutiny Collector" + +DEFAULT_HOST="127.0.0.1" +DEFAULT_PORT="8086" +DEFAULT_TOKEN="my-token" +DEFAULT_ORG="my-org" +DEFAULT_BUCKET="bucket" + +# Prompt the user for input +read -r -p "Enter InfluxDB Host/IP [$DEFAULT_HOST]: " HOST +HOST=${HOST:-$DEFAULT_HOST} + +read -r -p "Enter InfluxDB Port [$DEFAULT_PORT]: " PORT +PORT=${PORT:-$DEFAULT_PORT} + +read -r -p "Enter InfluxDB Token [$DEFAULT_TOKEN]: " TOKEN +TOKEN=${TOKEN:-$DEFAULT_TOKEN} + +read -r -p "Enter InfluxDB Organization [$DEFAULT_ORG]: " ORG +ORG=${ORG:-$DEFAULT_ORG} + +read -r -p "Enter InfluxDB Bucket [$DEFAULT_BUCKET]: " BUCKET +BUCKET=${BUCKET:-$DEFAULT_BUCKET} + +msg_info "Setup InfluxDB-Connection" +cat << EOF >/opt/scrutiny/config/scrutiny.yaml +version: 1 +web: + listen: + port: 8080 + host: 0.0.0.0 + + database: + location: /opt/scrutiny/config/scrutiny.db + src: + frontend: + path: /opt/scrutiny/web + + influxdb: + host: $HOST + port: $PORT + token: '$TOKEN' + org: '$ORG' + bucket: '$BUCKET' + retention_policy: true + # tls: + # insecure_skip_verify: false + +log: + file: '' #absolute or relative paths allowed, eg. web.log + level: INFO +EOF +msg_ok "Setup InfluxDB-Connection" + +SCRUTINY_OPTION="1" +read -r -p "Choose an option: +1) Start Scrutiny with GUI +2) Start Scrutiny Collector only +Enter your choice (1/2): " SCRUTINY_OPTION + +if [[ $SCRUTINY_OPTION == "1" ]]; then + cat </etc/systemd/system/scrutiny.service +[Unit] +Description=Scrutiny - Hard Drive Monitoring and Webapp +After=network.target + +[Service] +Type=simple +ExecStart=/opt/scrutiny/bin/scrutiny-web-linux-amd64 start --config /opt/scrutiny/config/scrutiny.yaml +Restart=always +User=root + +[Install] +WantedBy=multi-user.target +EOF + systemctl enable -q --now scrutiny.service + msg_ok "Created and enabled Scrutiny Webapp service" + +elif [[ $SCRUTINY_OPTION == "2" ]]; then + cat </etc/systemd/system/scrutiny_collector.service +[Unit] +Description=Scrutiny Collector - Collect Metrics +After=network.target + +[Service] +Type=simple +ExecStart=/opt/scrutiny/bin/scrutiny-collector-metrics-linux-amd64 run --api-endpoint "http://localhost:8080" +Restart=always +User=root + +[Install] +WantedBy=multi-user.target +EOF + systemctl enable -q --now scrutiny_collector.service + msg_ok "Created and enabled Scrutiny Collector service" + +else + msg_error "Invalid option selected. Starting Scrutiny with GUI by default." + cat </etc/systemd/system/scrutiny.service +[Unit] +Description=Scrutiny - Hard Drive Monitoring and Webapp +After=network.target + +[Service] +Type=simple +ExecStart=/opt/scrutiny/bin/scrutiny-web-linux-amd64 start --config /opt/scrutiny/config/scrutiny.yaml +Restart=always +User=root + +[Install] +WantedBy=multi-user.target +EOF + systemctl enable -q --now scrutiny.service + msg_ok "Created and enabled Scrutiny Webapp service (default option)" +fi + +motd_ssh +customize + +msg_info "Cleaning up" +$STD apt-get -y autoremove +$STD apt-get -y autoclean +msg_ok "Cleaned" From 977fe99b145b5938602418970d6f2ef6a29716e9 Mon Sep 17 00:00:00 2001 From: CanbiZ <47820557+MickLesk@users.noreply.github.com> Date: Tue, 25 Jun 2024 14:31:39 +0200 Subject: [PATCH 2/8] remove local source to tteck source --- ct/scrutiny.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ct/scrutiny.sh b/ct/scrutiny.sh index 431d9d62..36a586fc 100644 --- a/ct/scrutiny.sh +++ b/ct/scrutiny.sh @@ -1,5 +1,5 @@ #!/usr/bin/env bash -source <(curl -s https://raw.githubusercontent.com/MickLesk/Proxmox_DEV/main/misc/build.func) +source <(curl -s https://raw.githubusercontent.com/tteck/Proxmox/main/misc/build.func) # Copyright (c) 2021-2024 tteck # Author: tteck # Co-Author: MickLesk (Canbiz) @@ -186,4 +186,4 @@ description msg_ok "Completed Successfully!\n" echo -e "${APP} Setup should be reachable by going to the following URL. - ${BL}http://${IP}:8080${CL} \n" \ No newline at end of file + ${BL}http://${IP}:8080${CL} \n" From ea9849e77047fd805b6d8c9c5b03732ef95f4d8d Mon Sep 17 00:00:00 2001 From: CanbiZ <47820557+MickLesk@users.noreply.github.com> Date: Tue, 25 Jun 2024 16:42:15 +0200 Subject: [PATCH 3/8] Remove Collector in Install --- install/scrutiny-install.sh | 60 ++----------------------------------- 1 file changed, 3 insertions(+), 57 deletions(-) diff --git a/install/scrutiny-install.sh b/install/scrutiny-install.sh index 349a9439..1f514cd8 100644 --- a/install/scrutiny-install.sh +++ b/install/scrutiny-install.sh @@ -36,30 +36,19 @@ cd /opt/scrutiny/web && tar xzf scrutiny-web-frontend.tar.gz --strip-components chmod +x /opt/scrutiny/bin/scrutiny-web-linux-amd64 msg_ok "Installed Scrutiny WebApp" -msg_info "Installing Scrutiny Collector" -wget -q -O /opt/scrutiny/bin/scrutiny-collector-metrics-linux-amd64 "https://github.com/AnalogJ/scrutiny/releases/download/${RELEASE}/scrutiny-collector-metrics-linux-amd64" -chmod +x /opt/scrutiny/bin/scrutiny-collector-metrics-linux-amd64 -msg_ok "Installed Scrutiny Collector" - DEFAULT_HOST="127.0.0.1" DEFAULT_PORT="8086" DEFAULT_TOKEN="my-token" DEFAULT_ORG="my-org" DEFAULT_BUCKET="bucket" - -# Prompt the user for input read -r -p "Enter InfluxDB Host/IP [$DEFAULT_HOST]: " HOST HOST=${HOST:-$DEFAULT_HOST} - read -r -p "Enter InfluxDB Port [$DEFAULT_PORT]: " PORT PORT=${PORT:-$DEFAULT_PORT} - read -r -p "Enter InfluxDB Token [$DEFAULT_TOKEN]: " TOKEN TOKEN=${TOKEN:-$DEFAULT_TOKEN} - read -r -p "Enter InfluxDB Organization [$DEFAULT_ORG]: " ORG ORG=${ORG:-$DEFAULT_ORG} - read -r -p "Enter InfluxDB Bucket [$DEFAULT_BUCKET]: " BUCKET BUCKET=${BUCKET:-$DEFAULT_BUCKET} @@ -93,14 +82,8 @@ log: EOF msg_ok "Setup InfluxDB-Connection" -SCRUTINY_OPTION="1" -read -r -p "Choose an option: -1) Start Scrutiny with GUI -2) Start Scrutiny Collector only -Enter your choice (1/2): " SCRUTINY_OPTION - -if [[ $SCRUTINY_OPTION == "1" ]]; then - cat </etc/systemd/system/scrutiny.service +msg_info "Setup Service" +cat </etc/systemd/system/scrutiny.service [Unit] Description=Scrutiny - Hard Drive Monitoring and Webapp After=network.target @@ -115,45 +98,8 @@ User=root WantedBy=multi-user.target EOF systemctl enable -q --now scrutiny.service - msg_ok "Created and enabled Scrutiny Webapp service" +msg_ok "Created and enabled Service" -elif [[ $SCRUTINY_OPTION == "2" ]]; then - cat </etc/systemd/system/scrutiny_collector.service -[Unit] -Description=Scrutiny Collector - Collect Metrics -After=network.target - -[Service] -Type=simple -ExecStart=/opt/scrutiny/bin/scrutiny-collector-metrics-linux-amd64 run --api-endpoint "http://localhost:8080" -Restart=always -User=root - -[Install] -WantedBy=multi-user.target -EOF - systemctl enable -q --now scrutiny_collector.service - msg_ok "Created and enabled Scrutiny Collector service" - -else - msg_error "Invalid option selected. Starting Scrutiny with GUI by default." - cat </etc/systemd/system/scrutiny.service -[Unit] -Description=Scrutiny - Hard Drive Monitoring and Webapp -After=network.target - -[Service] -Type=simple -ExecStart=/opt/scrutiny/bin/scrutiny-web-linux-amd64 start --config /opt/scrutiny/config/scrutiny.yaml -Restart=always -User=root - -[Install] -WantedBy=multi-user.target -EOF - systemctl enable -q --now scrutiny.service - msg_ok "Created and enabled Scrutiny Webapp service (default option)" -fi motd_ssh customize From d4fa5ee35747c944e33e44e3ab6106cd9b4349b7 Mon Sep 17 00:00:00 2001 From: CanbiZ <47820557+MickLesk@users.noreply.github.com> Date: Tue, 25 Jun 2024 16:43:42 +0200 Subject: [PATCH 4/8] Update scrutiny.sh --- ct/scrutiny.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/ct/scrutiny.sh b/ct/scrutiny.sh index 36a586fc..95b4e790 100644 --- a/ct/scrutiny.sh +++ b/ct/scrutiny.sh @@ -65,7 +65,7 @@ function update_script() { UPD=$(whiptail --backtitle "Proxmox VE Helper Scripts" --title "Scrutiny Management" --radiolist --cancel-button Exit-Script "Spacebar = Select" 11 58 3 \ "1" "Update Scrutiny to $RELEASE" ON \ "2" "Start Scrutiny Webapp" OFF \ - "3" "Start Scrutiny Collector" OFF \ + "3" "Create/Start Scrutiny Collector" OFF \ 3>&1 1>&2 2>&3) header_info @@ -155,6 +155,8 @@ if [ "$UPD" == "3" ]; then msg_ok "Stopped Scrutiny Collector Service" else msg_info "Scrutiny Collector Service not found, creating..." + wget -q -O /opt/scrutiny/bin/scrutiny-collector-metrics-linux-amd64 "https://github.com/AnalogJ/scrutiny/releases/download/${RELEASE}/scrutiny-collector-metrics-linux-amd64" + chmod +x /opt/scrutiny/bin/scrutiny-collector-metrics-linux-amd64 cat </etc/systemd/system/scrutiny_collector.service [Unit] Description=Scrutiny Collector From 5d3b287e5343799772cec025dc6911a066ec77e1 Mon Sep 17 00:00:00 2001 From: CanbiZ <47820557+MickLesk@users.noreply.github.com> Date: Tue, 25 Jun 2024 17:02:43 +0200 Subject: [PATCH 5/8] remove user inputs --- install/scrutiny-install.sh | 47 +------------------------------------ 1 file changed, 1 insertion(+), 46 deletions(-) diff --git a/install/scrutiny-install.sh b/install/scrutiny-install.sh index 1f514cd8..da6083d3 100644 --- a/install/scrutiny-install.sh +++ b/install/scrutiny-install.sh @@ -30,58 +30,13 @@ mkdir -p /opt/scrutiny/web mkdir -p /opt/scrutiny/bin RELEASE=$(curl -s https://api.github.com/repos/analogj/scrutiny/releases/latest | grep "tag_name" | awk '{print substr($2, 2, length($2)-3) }') echo "${RELEASE}" >/opt/scrutiny_version.txt +wget -q -O /opt/scrutiny/config/scrutiny.yaml https://raw.githubusercontent.com/AnalogJ/scrutiny/master/example.scrutiny.yaml wget -q -O /opt/scrutiny/bin/scrutiny-web-linux-amd64 "https://github.com/AnalogJ/scrutiny/releases/download/${RELEASE}/scrutiny-web-linux-amd64" wget -q -O /opt/scrutiny/web/scrutiny-web-frontend.tar.gz "https://github.com/AnalogJ/scrutiny/releases/download/${RELEASE}/scrutiny-web-frontend.tar.gz" cd /opt/scrutiny/web && tar xzf scrutiny-web-frontend.tar.gz --strip-components 1 -C . chmod +x /opt/scrutiny/bin/scrutiny-web-linux-amd64 msg_ok "Installed Scrutiny WebApp" -DEFAULT_HOST="127.0.0.1" -DEFAULT_PORT="8086" -DEFAULT_TOKEN="my-token" -DEFAULT_ORG="my-org" -DEFAULT_BUCKET="bucket" -read -r -p "Enter InfluxDB Host/IP [$DEFAULT_HOST]: " HOST -HOST=${HOST:-$DEFAULT_HOST} -read -r -p "Enter InfluxDB Port [$DEFAULT_PORT]: " PORT -PORT=${PORT:-$DEFAULT_PORT} -read -r -p "Enter InfluxDB Token [$DEFAULT_TOKEN]: " TOKEN -TOKEN=${TOKEN:-$DEFAULT_TOKEN} -read -r -p "Enter InfluxDB Organization [$DEFAULT_ORG]: " ORG -ORG=${ORG:-$DEFAULT_ORG} -read -r -p "Enter InfluxDB Bucket [$DEFAULT_BUCKET]: " BUCKET -BUCKET=${BUCKET:-$DEFAULT_BUCKET} - -msg_info "Setup InfluxDB-Connection" -cat << EOF >/opt/scrutiny/config/scrutiny.yaml -version: 1 -web: - listen: - port: 8080 - host: 0.0.0.0 - - database: - location: /opt/scrutiny/config/scrutiny.db - src: - frontend: - path: /opt/scrutiny/web - - influxdb: - host: $HOST - port: $PORT - token: '$TOKEN' - org: '$ORG' - bucket: '$BUCKET' - retention_policy: true - # tls: - # insecure_skip_verify: false - -log: - file: '' #absolute or relative paths allowed, eg. web.log - level: INFO -EOF -msg_ok "Setup InfluxDB-Connection" - msg_info "Setup Service" cat </etc/systemd/system/scrutiny.service [Unit] From 29ccfc9d2003dda8e75ed0f250336c7cbb7c8c43 Mon Sep 17 00:00:00 2001 From: CanbiZ <47820557+MickLesk@users.noreply.github.com> Date: Tue, 25 Jun 2024 17:22:16 +0200 Subject: [PATCH 6/8] Update scrutiny.sh --- ct/scrutiny.sh | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/ct/scrutiny.sh b/ct/scrutiny.sh index 95b4e790..c9c4734d 100644 --- a/ct/scrutiny.sh +++ b/ct/scrutiny.sh @@ -53,7 +53,6 @@ function default_settings() { echo_default } - function update_script() { if [[ ! -d /opt/scrutiny ]]; then msg_error "No ${APP} Installation Found!" @@ -62,10 +61,11 @@ function update_script() { RELEASE=$(curl -s https://api.github.com/repos/AnalogJ/scrutiny/releases/latest | grep "tag_name" | awk '{print substr($2, 2, length($2)-3) }') - UPD=$(whiptail --backtitle "Proxmox VE Helper Scripts" --title "Scrutiny Management" --radiolist --cancel-button Exit-Script "Spacebar = Select" 11 58 3 \ + UPD=$(whiptail --backtitle "Proxmox VE Helper Scripts" --title "Scrutiny Management" --radiolist --cancel-button Exit-Script "Spacebar = Select" 15 70 4 \ "1" "Update Scrutiny to $RELEASE" ON \ "2" "Start Scrutiny Webapp" OFF \ "3" "Create/Start Scrutiny Collector" OFF \ + "4" "Change Scrutiny Settings" OFF \ 3>&1 1>&2 2>&3) header_info @@ -114,7 +114,6 @@ function update_script() { fi exit fi - if [ "$UPD" == "2" ]; then msg_info "Checking for Scrutiny Webapp Service" if systemctl list-units --full -all | grep -Fq 'scrutiny.service'; then @@ -180,6 +179,10 @@ EOF msg_ok "Started Scrutiny Collector Service" exit fi +if [ "$UPD" == "4" ]; then + nano /opt/scrutiny/config/scrutiny.yaml + exit +fi } start From 546b65d59ea9a1033473fa97ad14de458499111d Mon Sep 17 00:00:00 2001 From: CanbiZ <47820557+MickLesk@users.noreply.github.com> Date: Tue, 25 Jun 2024 17:56:21 +0200 Subject: [PATCH 7/8] Update scrutiny-install.sh --- install/scrutiny-install.sh | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/install/scrutiny-install.sh b/install/scrutiny-install.sh index da6083d3..5e534e87 100644 --- a/install/scrutiny-install.sh +++ b/install/scrutiny-install.sh @@ -25,15 +25,14 @@ $STD apt-get install -y \ msg_ok "Installed Dependencies" msg_info "Installing Scrutiny WebApp" -mkdir -p /opt/scrutiny/config -mkdir -p /opt/scrutiny/web -mkdir -p /opt/scrutiny/bin +mkdir -p /opt/scrutiny/{config,web,bin} RELEASE=$(curl -s https://api.github.com/repos/analogj/scrutiny/releases/latest | grep "tag_name" | awk '{print substr($2, 2, length($2)-3) }') -echo "${RELEASE}" >/opt/scrutiny_version.txt +echo "${RELEASE}" >/opt/${APP}_version.txt wget -q -O /opt/scrutiny/config/scrutiny.yaml https://raw.githubusercontent.com/AnalogJ/scrutiny/master/example.scrutiny.yaml wget -q -O /opt/scrutiny/bin/scrutiny-web-linux-amd64 "https://github.com/AnalogJ/scrutiny/releases/download/${RELEASE}/scrutiny-web-linux-amd64" wget -q -O /opt/scrutiny/web/scrutiny-web-frontend.tar.gz "https://github.com/AnalogJ/scrutiny/releases/download/${RELEASE}/scrutiny-web-frontend.tar.gz" -cd /opt/scrutiny/web && tar xzf scrutiny-web-frontend.tar.gz --strip-components 1 -C . +cd /opt/scrutiny/web +tar xzf scrutiny-web-frontend.tar.gz --strip-components 1 -C . chmod +x /opt/scrutiny/bin/scrutiny-web-linux-amd64 msg_ok "Installed Scrutiny WebApp" @@ -52,10 +51,9 @@ User=root [Install] WantedBy=multi-user.target EOF - systemctl enable -q --now scrutiny.service +systemctl enable -q --now scrutiny.service msg_ok "Created and enabled Service" - motd_ssh customize From aec34707601d7a28b736567e61584c039fb1d5ef Mon Sep 17 00:00:00 2001 From: CanbiZ <47820557+MickLesk@users.noreply.github.com> Date: Tue, 25 Jun 2024 17:56:51 +0200 Subject: [PATCH 8/8] Update scrutiny.sh --- ct/scrutiny.sh | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/ct/scrutiny.sh b/ct/scrutiny.sh index c9c4734d..9b22fb8b 100644 --- a/ct/scrutiny.sh +++ b/ct/scrutiny.sh @@ -54,11 +54,7 @@ function default_settings() { } function update_script() { - if [[ ! -d /opt/scrutiny ]]; then - msg_error "No ${APP} Installation Found!" - exit - fi - + if [[ ! -d /opt/scrutiny ]]; then msg_error "No ${APP} Installation Found!"; exit; fi RELEASE=$(curl -s https://api.github.com/repos/AnalogJ/scrutiny/releases/latest | grep "tag_name" | awk '{print substr($2, 2, length($2)-3) }') UPD=$(whiptail --backtitle "Proxmox VE Helper Scripts" --title "Scrutiny Management" --radiolist --cancel-button Exit-Script "Spacebar = Select" 15 70 4 \ @@ -70,7 +66,7 @@ function update_script() { header_info if [ "$UPD" == "1" ]; then - if [[ "${RELEASE}" != "$(cat /opt/scrutiny_version.txt)" ]] || [[ ! -f /opt/scrutiny_version.txt ]]; then + if [[ ! -f /opt/${APP}_version.txt ]] || [[ "${RELEASE}" != "$(cat /opt/${APP}_version.txt)" ]]; then msg_info "Stopping all Scrutiny Services" WEBAPP_ACTIVE=$(systemctl is-active scrutiny.service)