0

I write a script for scheduling backup process .In that script i want to trigger a mail to the corresponding user and admin user as " Backup completed successfully for the $username at $date $time.what can i do .then which packages i need to install ...? please help me...!

#!/bin/bash

echo "---welcome to File Backup process---" 

whoami

#echo "--Please enter your public Key name--"
#read username

username=$(whoami)

echo "username:$username"

rsync -avz --delete --exclude=".bash_history" --exclude=".bash_logout" --exclude=".bashrc" --exclude=".cache*" --exclude=".profile" --exclude=".ssh*" /home/$username/ $username@server:/home/$username/

echo "--Backup completed--"

1 Answers1

0

. You can use mailx and mail with attachmet file.

echo 'Content' | mail -aFrom:from@domain.com -s 'Subject' -A attachment to@domain.com

(echo 'Content';uuencode filename file-attachment-path) | mailx -s subject to@domain.com
Mohsun
  • 11
  • 3