简体   繁体   中英

sending an email in unix and linux shell scripting

I am completely new to Linux, unix shell scripting I am into new role as support analyst on shell scripting. To introduce my self I am IT background but never worked with shell scripting. I have an idea and knowledge of basic commands but not in depth knowledge. I have a task today.

To send an email from terminal we need to install mailutils package first?

To alter the loop where the script detects the glassfish process is still running and send out an email after 10 attempts. code below

while [[ $glassfishPid -gt 0 ]];

do

 echo "Glassfish is running.  Killing Glassfish process..." $GlassfishPid

 kill -9 $GlassfishPid

 echo "Process killed" $GlassfishPid `date`

 GlassfishPid=`ps -ef|grep  "glassfish.jar" |grep -v grep|awk '{print $2}'`

 done

echo Glassfish shutdown at `date`.

Thank you very much

echo "hello" | sendmail -f from@gmail.com -t to@yahoo. It should send Hello. Let me know if it doesn't.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM