From 7a17fe4dcee235b5973326c6daedebccc2de41d2 Mon Sep 17 00:00:00 2001 From: Joe Carstairs Date: Wed, 26 Aug 2026 09:28:38 +0100 Subject: nginx auto-updates --- roles/nginx/files/update_nginx | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 roles/nginx/files/update_nginx (limited to 'roles/nginx/files/update_nginx') diff --git a/roles/nginx/files/update_nginx b/roles/nginx/files/update_nginx new file mode 100644 index 0000000..cf6ee6f --- /dev/null +++ b/roles/nginx/files/update_nginx @@ -0,0 +1,18 @@ +#!/bin/sh + +apk upgrade + +nginx_pid="$(pgrep nginx:\ master\ process)" +if [ -z "$nginx_pid" ] +then + rc-service nginx restart + exit 0 +fi + +nginx_proc_start_time="$(stat -Lc %Y /proc/${nginx_pid})" +nginx_file_mtime="$(stat -Lc %Y $(which nginx))" + +if [ "$nginx_file_mtime" -gt "$nginx_proc_start_time" ] +then + rc-service nginx restart +fi -- cgit v1.2.3