move old files to old directory

Signed-off-by: Václav Valíček <valicek1994@gmail.com>
This commit is contained in:
2022-05-04 09:46:41 +02:00
parent 3d12f83d26
commit b536c883de
28 changed files with 0 additions and 0 deletions

44
old/dockerbin/cron-command Executable file
View File

@@ -0,0 +1,44 @@
#!/bin/bash
set -euo pipefail
IFS=$'\n\t'
# try to include laminar env
if [ -f /etc/profile.d/laminar.sh ]
then
source /etc/profile.d/laminar.sh
fi
# if started as root
if [ $UID -eq 0 ]
then
find /data \! -user executor -exec chown executor:executor {} \;
su executor -c cron-command
exit $?
fi
# 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
echo "Cron Finished"