Looking for advice - bash script is not sending email

What is the problem you are having with rclone?

I wrote a script to run an rclone cron job on TrueNAS Scale. The script runs but it is not sending email. Can someone look at the script and give me an idea what may be missing and/or why mail is not sending. The log file is saving as expected.

Thank you in advance

Run the command 'rclone version' and share the full output of the command.

rclone v1.67.0

  • os/version: debian 12.6 (64 bit)
  • os/kernel: 6.6.44-production+truenas (x86_64)
  • os/type: linux
  • os/arch: amd64
  • go/version: go1.22.7
  • go/linking: dynamic
  • go/tags: none

Which cloud storage system are you using? (eg Google Drive)

OneDrive

The command you were trying to run (eg rclone copy /tmp remote:tmp)

#!/usr/local/bin/bash
CURRENTDATEFILENAME=`date +"%d-%m-%Y"`
rclone sync  --progress  --no-update-dir-modtime --csv --create-empty-src-dirs --multi-thread-streams=8 --transfers 4 --log-file=/home/admin/rclonelog/rclone-${CURRENTDATEFILENAME}.log -v /mnt/MYPOOL/MYSHARE MY-ONEDRIVE-REMOTE:/
cat rclone-${CURRENTDATEFILENAME}.log | mail -s "CloudSync Report" myname@mydomain.com

Please run 'rclone config redacted' and share the full output. If you get command not found, please make sure to update rclone.

[MY-ONEDRIVE-REMOTE]
type = onedrive
client_id = XXX
client_secret = XXX
token = XXX
drive_id = XXX
drive_type = personal

A log from the command that you were trying to run with the -vv flag

There is nothing in the log related to my issue.

This is your log file.

You cat something else. Probably not existing.

And it is not rclone problem at all. You should check on bash forums if you have problems with your scripts.

I watch the file system while the job is running. The log file exists on disk and I can even open it and see what was written (while it is not a good idea).

So, once the rclone part is over the mail procedure should be able to cat the log file.

So cat log file. Not something else.

I got it. Should be this
cat /home/admin/rclonelog/rclonerclone-${CURRENTDATEFILENAME}.log | mail -s "CloudSync Report" myname@mydomain.com

Will check when the cron job runs tonight.

Thank you

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.