Skip to content

Commit 23ed2b4

Browse files
authored
Update ee-sites-log
1 parent 2de8bab commit 23ed2b4

File tree

1 file changed

+18
-16
lines changed

1 file changed

+18
-16
lines changed

logrotate/logrotate.d/ee-sites-log

Lines changed: 18 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,22 @@
11
/opt/easyengine/sites/*/logs/nginx/*.log
22
/opt/easyengine/sites/*/logs/php/*.log
33
{
4-
weekly
5-
missingok
6-
rotate 12
7-
compress
8-
delaycompress
9-
notifempty
10-
sharedscripts
11-
postrotate
12-
for site in $(sudo /usr/bin/docker compose -f /home/cloud-user/easyengine/docker-compose.yml run --rm easyengine ee site list --format=text --enabled); do
13-
absolute_site_php=$(echo $site | sed -e 's/\.//g' )-php-1
14-
absolute_site_nginx=$(echo $site | sed -e 's/\.//g' )-nginx-1
15-
$(sudo /usr/bin/docker inspect -f '{{ .State.Pid }}' $absolute_site_nginx | xargs sudo /usr/bin/kill -USR1) || echo "ok"
16-
$(sudo /usr/bin/docker inspect -f '{{ .State.Pid }}' $absolute_site_php | xargs sudo /usr/bin/kill -USR1) || echo "ok"
17-
echo "$(date +'[%d/%m/%Y %H:%M:%S]') LogRotate.INFO: Rotated logs for $site" | sudo tee -a /opt/easyengine/logs/ee.log >/dev/null
18-
done
19-
endscript
4+
weekly
5+
missingok
6+
rotate 12
7+
compress
8+
delaycompress
9+
notifempty
10+
sharedscripts
11+
postrotate
12+
for site in $(/usr/bin/docker compose -f /home/cloud-user/easyengine/docker-compose.yml run --rm easyengine ee site list --format=text --enabled); do
13+
absolute_site_php=$(echo $site | sed -e 's/\.//g')-php-1
14+
absolute_site_nginx=$(echo $site | sed -e 's/\.//g')-nginx-1
15+
16+
/usr/bin/docker inspect -f '{{ .State.Pid }}' $absolute_site_nginx | xargs /usr/bin/kill -USR1 || echo "ok"
17+
/usr/bin/docker inspect -f '{{ .State.Pid }}' $absolute_site_php | xargs /usr/bin/kill -USR1 || echo "ok"
18+
19+
echo "$(date +'[%d/%m/%Y %H:%M:%S]') LogRotate.INFO: Rotated logs for $site" >> /opt/easyengine/logs/ee.log
20+
done
21+
endscript
2022
}

0 commit comments

Comments
 (0)