Added rand sleep for use with crone
Часто скрипты в кроне запускаются одновременно, чтобы избежать одновременного запуска ставлю рандмный slelep
This commit is contained in:
@@ -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!" ;
|
||||||
|
|||||||
Reference in New Issue
Block a user