2017-09-02 139 views
0

我編寫了一個用於安排備份過程的腳本。在該腳本中,我希望觸發郵件給相應的用戶和管理員用戶,例如「$ date $ time.what我該怎麼辦。後來我需要安裝的包......?請幫我...!從shell腳本發送郵件

#!/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/ [email protected]:/home/$username/ 

echo "--Backup completed--" 
+0

看一看[man mail](https://linux.die.net/man/1/mail)。 –

回答