Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Unix Mailx command not working

Status
Not open for further replies.

LokM

Programmer
Feb 17, 2016
1
US
Hi All,

i'm trying to create a shell script which will perform a dataload and sends out the mail in case the status ends with an error. i'm using Notepad++ to create this shell script and using .sh file extension.

i'm using the following statement is used to send the email.
uuencode ${COMMERCE_FOLDER}/logs/wc-dataload.log | mailx -s "INVENTORY DATALOAD for ${DATALOAD_DAYSTAMP} " ${EMAIL_LIST}

the script does not finish executing itself and waiting this line forever. However when i do CTRL+C the program exits and the mail is received. Also the attachment never gets attached to the mail. i tried just using the mail alone without any attachment like below still same issue and needs CTRL+X to exit the script.

mailx -s "INVENTORY DATALOAD for ${DATALOAD_DAYSTAMP} " ${EMAIL_LIST}

Also note that i tried with only the email statement in the entire shell script but still same result.

Please help understand the issue here and suggest.
 
you can try the -v option and maybe you can see what's going on (or not going on)

==================================
adaptive uber info galaxies (bigger, better, faster, and more adept than cognitive innovative agile big data clouds)


 
The command "[tt]uuencode[/tt]" is your hangup. If you only give it one parameter, you need to pipt your file to it. Or you can give it two parameters. First parameter will be the file it encodes, second parameter will be the name it gives the attachment. So this should do it...

Code:
uuencode ${COMMERCE_FOLDER}/logs/wc-dataload.log [u]wc-dataload.log[/u] | mailx -s "INVENTORY DATALOAD for ${DATALOAD_DAYSTAMP} " ${EMAIL_LIST}




 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top