# ${RANDOM:0:2}m -> [10m - 99m], used to distribute task in time
# The `umask 077` subshell exists solely so flock's lazy creation of
# /var/run/xray_tasks.cronlock lands at 0600: a world-readable lock lets an
# unprivileged user hold a shared flock(2) on it and starve the exclusive
# `flock -n` below (CLPRO-3240 F-08). It must NOT leak into the manager -- that
# run re-creates files which have to stay world-readable, notably the
# DirectAdmin /usr/local/phpNN/.../xray.so copy (0700 there means PHP cannot
# load the extension at all, ZD 290458) and xray.ini. So the payload restores
# the standard 0022 before exec'ing the manager.
0 5 * * * root bash -c "sleep ${RANDOM:0:2}m"; ( umask 077; /usr/bin/flock -n /var/run/xray_tasks.cronlock -c 'umask 0022; exec /usr/sbin/cloudlinux-xray-manager autocomplete-tasks' ) &> /dev/null
