-
Notifications
You must be signed in to change notification settings - Fork 1
Description
Description:
The backup-tool.sh script currently uses the mail command to send email notifications. However, if no Mail Transfer Agent (MTA) is installed, the script's execution fails when run via cron, resulting in discarded output. This prevents the crontab from completing successfully.
Syslog Details:
The syslogs show the following messages indicating the issue:
Jun 24 01:30:01 hostname-xxx CRON[2246694]: (root) CMD (bash /data/scripts/backup-tool.sh >/dev/null 2>&1)
Jun 24 01:30:01 hostname-xxx CRON[2246690]: (CRON) info (No MTA installed, discarding output)
Affected Command in Script:
The script fails at the following command due to the missing MTA:
cat $mailtext | mail -s "$mailsubject" $emailSuggested Solution:
Replace the mail command with an alternative method that does not require an MTA, such as using an SMTP server with a tool like msmtp or sendmail, or an API-based approach with a service like SendGrid, Mailgun, etc.
Steps to Reproduce:
- Ensure no MTA is installed on the system.
- Schedule the
backup-tool.shscript to run viacron. - Observe the syslogs for the error message related to the missing MTA.
Expected Behavior:
The backup-tool.sh script should complete successfully, sending email notifications without relying on a local MTA.
Additional Context:
This change is critical to ensure that the backup process can run smoothly in environments where an MTA is not available. Proper error handling and notification are essential for maintaining the reliability of the backup process.