Compare commits

..

2 Commits

Author SHA1 Message Date
CanbiZ (MickLesk) 3d914c7944 Remove header_info call from update_script function 2026-07-28 16:10:45 +02:00
CanbiZ (MickLesk) 65b1ba5112 npmplus: Remove duplicate msg_info for container recreation
Removed log message for recreating the container during update.
2026-07-28 16:07:52 +02:00
2 changed files with 22 additions and 47 deletions
-4
View File
@@ -21,8 +21,6 @@ color
catch_errors
function update_script() {
header_info "$APP"
msg_info "Updating Alpine OS"
$STD apk -U upgrade
msg_ok "System updated"
@@ -30,10 +28,8 @@ function update_script() {
msg_info "Pulling latest NPMplus container image"
cd /opt
$STD docker compose pull
msg_info "Recreating container"
$STD docker compose up -d
msg_ok "Updated NPMplus container"
msg_ok "Updated successfully!"
exit
}
@@ -35,32 +35,6 @@ if ! grep -qE 'ID=debian|ID=ubuntu' /etc/os-release 2>/dev/null; then
exit 238
fi
# ==============================================================================
# SERVICE FILE
# ==============================================================================
function write_service() {
cat <<EOF >"$SERVICE_PATH"
[Unit]
Description=Prometheus Paperless NGX Exporter
Wants=network-online.target
After=network-online.target
[Service]
User=root
EnvironmentFile=$CONFIG_PATH
ExecStart=$BINARY_PATH \\
--paperless_url=\${PAPERLESS_URL} \\
--paperless_auth_token_file=$AUTH_TOKEN_FILE \\
--paperless_header 'Accept: application/json; version=9' \\
--collectors=tag,correspondent,document_type,storage_path,task,log,group,user,status,statistics
Restart=always
[Install]
WantedBy=multi-user.target
EOF
systemctl daemon-reload
}
# ==============================================================================
# UNINSTALL
# ==============================================================================
@@ -83,31 +57,19 @@ function uninstall() {
# UPDATE
# ==============================================================================
function update() {
local release_found=1
if check_for_gh_release "prom-paperless-exp" "hansmi/prometheus-paperless-exporter"; then
release_found=0
msg_info "Stopping service"
systemctl stop prometheus-paperless-ngx-exporter
msg_ok "Stopped service"
fetch_and_deploy_gh_release "prom-paperless-exp" "hansmi/prometheus-paperless-exporter" "binary" "latest"
fi
msg_info "Refreshing service configuration"
write_service
msg_ok "Refreshed service configuration"
msg_info "Starting service"
systemctl restart prometheus-paperless-ngx-exporter
msg_ok "Started service"
if [[ $release_found -eq 0 ]]; then
msg_info "Starting service"
systemctl start prometheus-paperless-ngx-exporter
msg_ok "Started service"
msg_ok "Updated successfully!"
else
msg_ok "No new release found, service configuration refreshed"
exit
fi
exit
}
# ==============================================================================
@@ -131,7 +93,24 @@ EOF
msg_ok "Created configuration"
msg_info "Creating service"
write_service
cat <<EOF >"$SERVICE_PATH"
[Unit]
Description=Prometheus Paperless NGX Exporter
Wants=network-online.target
After=network-online.target
[Service]
User=root
EnvironmentFile=$CONFIG_PATH
ExecStart=$BINARY_PATH \\
--paperless_url=\${PAPERLESS_URL} \\
--paperless_auth_token_file=$AUTH_TOKEN_FILE
Restart=always
[Install]
WantedBy=multi-user.target
EOF
systemctl daemon-reload
systemctl enable -q --now prometheus-paperless-ngx-exporter
msg_ok "Created and started service"