Cron daily backup script not executing

Required Information

  • DietPi version: 9.8.0

Additional Information (if applicable)

  • Cron daily

Steps to reproduce

So I have this custom backup script beginning with: #!/bin/bash
I notice that is it not being executed as expected.

Expected behaviour

Script should backup configured files.

Actual behaviour

Nothing is created.

Can you share ls -la /etc/cron.daily/ as well as your script.

Scripts in /etc/cron.daily/ are executed by run-parts. Ensure your script filename does not contain invalid characters (e.g., dots or extensions). A valid name will be my_script, not my_script.sh.

First thanks for the quick answers :slight_smile:

Here is the result of the ls -la command:

-rw-r--r--  1 root root  102 Mar  2  2023 .placeholder
-rwxr-xr-x  1 root root 1478 May 25  2023 apt-compat
-rwxr-xr-x  1 root root  819 Nov 25 21:57 backup.sh
-rwxr-xr-x  1 root root 2614 Oct 18 01:16 dietpi
-rwxr-xr-x  1 root root  123 Mar 27  2023 dpkg

So it seems like I should rename the backup script indeed.

Moreover here is the content of the script:

#!/bin/bash
####################################
#
# Backup to NFS mount script.
#
####################################

# What to backup.
backup_files="/mnt/083c86b5-c226-4a06-b752-c54b6acc9402/docker/mosquitto /mnt/083c86b5-c226-4a06-b752-c54b6acc9402/docker/zigbee2mqtt  /mnt/083c86b5-c226-4a06-b752-c54b6acc9402/docker/homeassistant"

# Where to backup to.
dest="/mnt/083c86b5-c226-4a06-b752-c54b6acc9402/backup"

# Create archive filename.
day=$(date +%A)
hostname=$(hostname -s)
archive_file="$hostname-$day.tgz"

# Print start status message.
echo "Backing up $backup_files to $dest/$archive_file"
date
echo

# Backup the files using tar.
tar czf $dest/$archive_file $backup_files

# Print end status message.
echo
echo "Backup finished"
date

# Long listing of files in $dest to check file sizes.
ls -lh $dest

Yes that’s what need to be done