Convert into single docker image, change volume structure etc
Makefile inconsistent!
This commit is contained in:
30
dockerbin/cron-command
Executable file
30
dockerbin/cron-command
Executable file
@@ -0,0 +1,30 @@
|
||||
#!/bin/bash
|
||||
set -euo pipefail
|
||||
IFS=$'\n\t'
|
||||
|
||||
# check lock
|
||||
lock=/var/run/cloner.pid
|
||||
|
||||
dir_prefix=cloner
|
||||
|
||||
max_jobs=${JOBS:-3}
|
||||
|
||||
function die(){
|
||||
echo $@ 1>&2
|
||||
exit 1
|
||||
}
|
||||
|
||||
# first, check process
|
||||
if [ -f $lock ]
|
||||
then
|
||||
pid=$(cat $lock)
|
||||
# if it still runs, die not so quietly
|
||||
[ -n "$pid" ] && [ -d /proc/$pid ] && die "Another process running!"
|
||||
fi
|
||||
# else make some mess and setup trap
|
||||
echo $BASHPID > $lock
|
||||
|
||||
find /data -maxdepth 1 -type d -name "${dir_prefix}-*" | \
|
||||
parallel --lb -j $max_jobs -n 1 run-mirror-update
|
||||
|
||||
|
||||
Reference in New Issue
Block a user