How to use HTML markup tags inside Bash script

Posted by CONtext on Super User See other posts from Super User or by CONtext
Published on 2014-08-18T16:02:13Z Indexed on 2014/08/18 16:30 UTC
Read the original article Hit count: 452

Filed under:
|

I have crontab and a simple bash script that sends me emails every often containing PHP, NGINX, MYSQL errors from their log files. This is a simplified example.

#/home/user/status.sh
[email protected]
  PHP_ERROR=`tail -5 /var/log/php-fpm/error.log`
  NGINX_ERROR=`tail -5 /var/log/nginx/error.log`
  MYSQL_ERROR=`tail /var/log/mysqld.log`
  DISK_SPACE=`df -h`
  echo "

Today's, server report::
==================================
    DISK_SPACE: $DISK_SPACE
 ---------------------------------
    MEMORY_USAGE: $MEMORY_USAGE
-----------------------------------
    NGINX ERROR: $NGINX_ERROR
-----------------------------------
    PHP ERRORS: $PHP_ERROR
------------------------------------
    MYSQL_ERRORS: $MYSQL_ERROR
-------------------------------------
 " | mail -s "Server reports" $EMAIL

I know this is a very basic usage, but as you can see, I am trying to separate the errors, but not of the html tags including \n are working.

So, my question is, is it possible to use HTML tags to format the text, if not .. then what are the alternatives.

© Super User or respective owner

Related posts about linux

Related posts about bash