Skip to content

Commit

Permalink
Print message every 10 seconds while permissions task is running
Browse files Browse the repository at this point in the history
  • Loading branch information
xZero707 committed May 13, 2024
1 parent 475e8a3 commit 21c4ce4
Showing 1 changed file with 19 additions and 4 deletions.
23 changes: 19 additions & 4 deletions rootfs/etc/cont-init.d/99-webuser-permissions
Original file line number Diff line number Diff line change
@@ -1,10 +1,25 @@
#!/usr/bin/with-contenv sh
set -e

main() {
/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
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 &
}

main &
main() {
local counter=1
fix_permissions &
pid=$!

# Print status message every ~5 seconds
while kill -0 $pid 2>/dev/null; do
if [ $((counter % 5)) -eq 0 ]; then
echo "> Process \"99-webuser-permissions\" hasn't finished yet [${counter}]"
fi

counter=$((counter + 1))
sleep 1
done
}

main &

0 comments on commit 21c4ce4

Please sign in to comment.