-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Print message every 10 seconds while permissions task is running
- Loading branch information
Showing
1 changed file
with
19 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 & |