Hello I would really appreciate any help with this excercise to learna  little bit.I want to create a script and the crontab to make a backup of /home, /var and /opt. I need to copy files only if propietary's UID is > 499.The complete copy (level 0) will be every 1st month's day at 2:00 at nightThe incremental one (level 1) will be every months' even day at 4:00 at night.Those will be saved at /mnt/DiscoExterno/backups and it issupposed the directory already exists.We need to use tar, to create it, and then gzip to compress it.Names are in the format:nivelX_YYYYMMDD.tar.gzMy aproach:#!/bin/bash$BACKUP_DIR=/mnt/DiscoExterno/backups$DATE=$(date +%Y%m%d)case $1 in    0)  touch $BACKUP_DIR/n0        find /home /var /opt |        tar cfv nivel0_$DATE.tgz $BACKUP_DIR  -T -        gzip nivel0_$DATE.tgz    ;;    1)  find /home /var /opt -newer $BACKUP_DIR/n0 |        tar cvf nivel1_$DATE-1.tgz $BACKUP_DIR -T -        gzip nivel1_$DATE.tgz    ;;    *)  echo Error en el script >&2        exit 1    ;;esacMy doubts:How can I ask to check if the actual file's owner's UID is > 499?I would try something like:if [[ id -u $(find /home /var /opt -exec ls -l {} | cut -f 3) -gt 499 ]]... do copy of level 0 or 1...But my concern is with this approach I would need to find two times, one for the if and other for the copy itself which is dummy.Seeing other posts I would try tofind /home /var /opt -exec sh -c '  for f do    if [[ id -u $(ls -l f | cut -f 3) > 499 ]]       do       ...copy...       fi  done' sh {} +which looks better but I don't know if it would work.Also my crontab would be:00 02 01 * * ./copia.sh 000 04 */2 * * ./copia.sh 1My doubt:Does */2 mean every month's even day?If it starts at 01 it would be every odd day... but the excercise requires every even day, but my first intuition was to express it as */2 which is literally every 2 units, 2 ddays of the month.
Create a security copy plan: script and crontab
scripting;cron