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
  • Have a look at man mail. Commented Sep 2, 2017 at 5:59

1 Answer 1

0

. You can use mailx and mail with attachmet file.

echo 'Content' | mail -aFrom:[email protected] -s 'Subject' -A attachment [email protected]

(echo 'Content';uuencode filename file-attachment-path) | mailx -s subject [email protected]
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.