diff options
| author | Joe Carstairs <me@joeac.net> | 2026-08-26 09:28:38 +0100 |
|---|---|---|
| committer | Joe Carstairs <me@joeac.net> | 2026-08-26 09:28:38 +0100 |
| commit | 7a17fe4dcee235b5973326c6daedebccc2de41d2 (patch) | |
| tree | 781a901efbfdda4a5e170547669715cf92854888 /roles/nginx/files/update_nginx | |
| parent | 1837f2c9b1a00ce2d50ebb5f8c63032993a5d000 (diff) | |
nginx auto-updates
Diffstat (limited to 'roles/nginx/files/update_nginx')
| -rw-r--r-- | roles/nginx/files/update_nginx | 18 |
1 files changed, 18 insertions, 0 deletions
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 |
