diff --git a/rootfs/etc/s6-overlay/s6-rc.d/init-webuser-permissions/run b/rootfs/etc/s6-overlay/s6-rc.d/init-webuser-permissions/run new file mode 100755 index 0000000..89ec101 --- /dev/null +++ b/rootfs/etc/s6-overlay/s6-rc.d/init-webuser-permissions/run @@ -0,0 +1,35 @@ +#!/command/with-contenv bash +# shellcheck shell=bash + +fix_permissions() { + /usr/local/bin/attr /var/www true www-data:www-data 0770 2771 & + /usr/local/bin/attr /var/www/html/wp-content true www-data:www-data 2755 2755 & +} + +run_process() { + local counter=1 + local wait_pid="${1}" + + # Print status message every ~5 seconds + while kill -0 $wait_pid 2>/dev/null; do + if [ $((counter % 5)) -eq 0 ]; then + echo "Process hasn't finished yet [${counter}]" + fi + + counter=$((counter + 1)) + sleep 1 + done +} + +# init-webuser-permissions main +main() { + # This will prepend service name to all output from here + exec > >(while read line; do echo "[init-webuser-permissions] ${line}"; done) 2>&1 + + fix_permissions & + pid=$! + + echo "Running fix_permissions with PID ${pid} in foreground..." + run_process "${pid}" & +} +main \ No newline at end of file diff --git a/rootfs/etc/s6-overlay/s6-rc.d/init-webuser-permissions/type b/rootfs/etc/s6-overlay/s6-rc.d/init-webuser-permissions/type new file mode 100644 index 0000000..3d92b15 --- /dev/null +++ b/rootfs/etc/s6-overlay/s6-rc.d/init-webuser-permissions/type @@ -0,0 +1 @@ +oneshot \ No newline at end of file diff --git a/rootfs/etc/s6-overlay/s6-rc.d/init-webuser-permissions/up b/rootfs/etc/s6-overlay/s6-rc.d/init-webuser-permissions/up new file mode 100644 index 0000000..37d921e --- /dev/null +++ b/rootfs/etc/s6-overlay/s6-rc.d/init-webuser-permissions/up @@ -0,0 +1 @@ +/etc/s6-overlay/s6-rc.d/init-webuser-permissions/run \ No newline at end of file