Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
Next revision Both sides next revision
en:jobs:bashlinuxmail_encoding [2015/02/20 14:37]
admin created
en:jobs:bashlinuxmail_encoding [2015/02/20 14:55]
admin
Line 1: Line 1:
-=== Encoding problems with using mail linux utility ​for send reports ====+=== Encoding problems with using mail linux utility ​to send reports ====
  
-Recently we faced with encoding problem with using mail linux utility.+Recently we faced with encoding problem with using mail linux utility.\\ 
 + 
 +Below is a part of simple script that is using for send report with using cron.\\ 
 + 
 +   if [ $err_f -ne 0 ] 
 +     ​then 
 +      echo "​Backups directories $dirr_nn on rum-gpfsstorage0 were failed. 
 +        See logs $log_nn ​ on rum-gpfs-b1.scanex.ru in /​scripts/​logs/​ . Backups of other directories were successfull."​ | mail -r "​backup-rum-gpfs@scanex.ru"​ -s "​backup gpfs $dirr_nn directories failed"​ adm@scanex.ru 
 +      else 
 +      echo  "​Backups all gpfs directories were successfull."​ |    mail -r "​backup-rum-gpfs@scanex.ru"​ -s "​backups all gpfs directories were successfull"​ adm@scanex.ru 
 +      fi 
 + 
 +When it started by cron all body text was unreadable. We looked at mail header:\\ 
 + 
 +   ​User-Agent:​ Heirloom mailx 12.4 7/29/08 
 +   ​MIME-Version:​ 1.0 
 +   ​Content-Type:​ application/​octet-stream 
 +   ​Content-Transfer-Encoding:​ 8bit 
 + 
 +But when we started this script manualy all ware right. Mail header below:\\ 
 + 
 +   ​User-Agent:​ Heirloom mailx 12.4 7/29/08 
 +   ​MIME-Version:​ 1.0 
 +   ​Content-Type:​ text/plain; charset=utf-8 
 +   ​Content-Transfer-Encoding:​ 8bit 
 + 
 +To chenge content type to text/plain; charset=utf-8 we just add line to the begining of script:\\ 
 + 
 +  export LANG=en_US.UTF-8
  
  
en/jobs/bashlinuxmail_encoding.txt · Last modified: 2015/03/12 17:08 by admin
Recent changes RSS feed Debian Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki