add cron job creation

This commit is contained in:
Gerrit Gogel 2021-02-01 18:14:46 +01:00
parent 50b8433b2f
commit f9eca5c59a
2 changed files with 8 additions and 1 deletions

View file

@ -2,7 +2,7 @@
source /scripts/utils.sh source /scripts/utils.sh
trap 'sigterm' SIGTERM gc_cron &
start_server & start_server &
start_socat & start_socat &
keep_running keep_running

View file

@ -31,6 +31,13 @@ function stop_socat {
pkill -9 socat pkill -9 socat
} }
function gc_cron {
if [[ ! -z $GC_CRON ]]; then
echo "Scheduling garbage collection..."
(crontab -l ; echo "$GC_CRON /scripts/gc.sh >> /opt/seafile/logs/gc.log 2>&1") | crontab
service cron start
fi
}
function keep_running { function keep_running {
while true; do while true; do
tail -f /dev/null & wait ${!} tail -f /dev/null & wait ${!}