__random_date() {
min=$1
max=$(($2 - $min + 1))
num=$(date +%s%N)
echo $(($num % $max + $min))
}
__set_cron() {
_random=$(__random_date 1 59)
_path=/etc/cron.d/cron_job
cat >$_path <<-'EOF'
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
*/1 * * * * root sleep @@@; bash /apps/shell/job.sh >> /dev/null
EOF
sed -i "s/@@@/$_random/g" $_path
chmod 644 $_path
}
__set_cron