我有一個服務器應用程序,其中包含1500個進程ID,我需要一個shell腳本,它檢查每個小時是否進程已啓動,如果不啓動進程,使用「dsmc -u xxxx -p * *「如果沒有開始發送郵件到我的Gmail([email protected])。這裏是代碼如何發送郵件到我的Gmail帳戶。Linux腳本來檢查進程是否已啓動
if pidof -s vsftpd = /dev/null; then
echo 'ftp is stopped'
sudo /etc/init.d/vsftpd restart
else
echo "The FTP server is Down" | mail -s "Ftp Server is Down" [email protected]
fi
我沒有收到郵件到我的Gmail帳戶。 參考:http://rtcamp.com/wordpress-nginx/tutorials/linux/ubuntu-postfix-gmail-smtp/