-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #14 from seatable/add-logrotate
add logrotate
- Loading branch information
Showing
7 changed files
with
97 additions
and
2 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
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 |
---|---|---|
@@ -0,0 +1,3 @@ | ||
|
||
54 23 * * * /usr/sbin/logrotate -vf /scripts/logrotate-conf/seatable-nginx 2>> /opt/seatable-thumbnail/logs/logrotate.log | ||
55 23 * * * /usr/sbin/logrotate -vf /scripts/logrotate-conf/seatable-thumbnail 2>> /opt/seatable-thumbnail/logs/logrotate.log |
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 |
---|---|---|
@@ -0,0 +1,17 @@ | ||
/opt/nginx-logs/*.log { | ||
daily | ||
missingok | ||
rotate 7 | ||
# compress | ||
# delaycompress | ||
dateext | ||
dateformat .%Y-%m-%d | ||
notifempty | ||
# create 640 nginx adm | ||
sharedscripts | ||
postrotate | ||
if [ -f /var/run/nginx.pid ]; then | ||
kill -USR1 `cat /var/run/nginx.pid` | ||
fi | ||
endscript | ||
} |
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 |
---|---|---|
@@ -0,0 +1,17 @@ | ||
/opt/seatable-thumbnail/logs/seafile.log | ||
/opt/seatable-thumbnail/logs/seatable-thumbnail.log | ||
{ | ||
daily | ||
missingok | ||
rotate 7 | ||
# compress | ||
# delaycompress | ||
dateext | ||
dateformat .%Y-%m-%d | ||
notifempty | ||
create 644 root root | ||
sharedscripts | ||
postrotate | ||
/scripts/logrotate-conf/seatable-thumbnail-restart.sh | ||
endscript | ||
} |
53 changes: 53 additions & 0 deletions
53
docker/scripts/logrotate-conf/seatable-thumbnail-restart.sh
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 |
---|---|---|
@@ -0,0 +1,53 @@ | ||
#!/bin/bash | ||
|
||
function stop_server() { | ||
pkill -9 -f seaf-server | ||
pkill -9 -f uvicorn | ||
pkill -9 -f multiprocessing | ||
|
||
rm -f /opt/seatable-thumbnail/pids/*.pid | ||
} | ||
|
||
function set_env() { | ||
export SRC_DIR=/opt/seatable-thumbnail/ | ||
export LD_LIBRARY_PATH=/opt/seatable-thumbnail/seafile/lib/ | ||
export PYTHONPATH=/opt/seatable-thumbnail/seafile/lib/python3.6/site-packages/:/usr/lib/python3.6/dist-packages:/usr/lib/python3.6/site-packages:/usr/local/lib/python3.6/dist-packages:/usr/local/lib/python3.6/site-packages | ||
export PATH=/opt/seatable-thumbnail/seafile/bin/:$PATH | ||
|
||
export CCNET_CONF_DIR=/opt/seatable-thumbnail/ccnet | ||
export SEAFILE_CONF_DIR=/opt/seatable-thumbnail/seafile-data | ||
export SEAFILE_CENTRAL_CONF_DIR=/opt/seatable-thumbnail/conf | ||
} | ||
|
||
|
||
function start_server() { | ||
|
||
stop_server | ||
sleep 0.5 | ||
|
||
set_env | ||
|
||
seaf-server -F /opt/seatable-thumbnail/conf -c /opt/seatable-thumbnail/ccnet -d /opt/seatable-thumbnail/seafile-data -l /opt/seatable-thumbnail/logs/seafile.log -L /opt/seatable-thumbnail -P /opt/seatable-thumbnail/pids/seafile.pid - & | ||
sleep 0.2 | ||
|
||
cd /opt/seatable-thumbnail/seatable-thumbnail-server/ | ||
/usr/local/bin/uvicorn main:app --host 127.0.0.1 --port 8088 --workers 4 --access-log --proxy-headers &>> /opt/seatable-thumbnail/logs/seatable-thumbnail.log & | ||
sleep 0.2 | ||
|
||
echo "SeaTable-thumbnail-server started by logrotate" | ||
echo | ||
|
||
} | ||
|
||
|
||
case $1 in | ||
"start") | ||
start_server | ||
;; | ||
"stop") | ||
stop_server | ||
;; | ||
*) | ||
start_server | ||
;; | ||
esac |
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
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