Added rand sleep for use with crone

Часто скрипты в кроне запускаются одновременно, чтобы избежать одновременного запуска ставлю рандмный slelep
This commit is contained in:
Naum Soloveychik
2020-01-15 15:25:57 +03:00
parent 89bef17914
commit aa6faf3a2c

View File

@@ -121,6 +121,9 @@ if [ "${dir}" = "" ] || [ ! -d ${dir} ] ; then
exit 1 ; exit 1 ;
fi fi
# sleep random 1-6 sec for crone
sleep `shuf -i0-9 -n1` ;
if [ -s ${pidfile} ] ; then if [ -s ${pidfile} ] ; then
error "ERROR: `hostname` script ${script} already running! Pid file \"${pidfile}\" exists!" ; error "ERROR: `hostname` script ${script} already running! Pid file \"${pidfile}\" exists!" ;