79259822

Date: 2024-12-07 02:13:42
Score: 1
Natty:
Report link

Failure to include #!/bin/bash or similar in the .sh file can and WILL lead to very strange things! In example, here's a daily backup script snippet:

cd /home/user/

rsync -vaHAWXS --delete --exclude={"BOINC/","TEMP/","DATA/","NTFS/",".*","snap/"} ~/ ~/DATA/BACKUPS/home/user >rsync_home.out 2>rsync_home.err

Without #!/bin/bash in daily_backup.sh, the script still works perfectly when invoked from the command line via SSH. However, when invoked via Crontab, the rsync still runs, but the --exclude= is ignored. This caused a circular reference in the backup source files which filled the backup destination drive and crashed the system.

Reasons:
  • Long answer (-0.5):
  • No code block (0.5):
  • Low reputation (1):
Posted by: Jimbocous