Author Topic: intermittent blank mail alert  (Read 288 times)

Offline adizero

  • Member
  • **
  • Posts: 259
intermittent blank mail alert
« on: August 11, 2016, 02:52:00 PM »
mga bro

baka may idea kayo.  nagrun ito via crontab every hour.   Basically nagsend sya ng alert system log every hr thru ssmtp.  ubuntu.  pero may time na narereceived namin ung email with correct subject pero  walang email body

meron ba kayo napapansing mali na possible cause ng intermittent blank email body ?

Function sya ng script.



script1.sh

# ----------------------------------------------------------------------------
send_alert()
{

cat | send_email $SUBJECT <<EOF2 &


`echo "$MESSAGE"`
`echo "$MESSAGE"`
`echo "$MESSAGE"`

Computer Time
-------------
`date -u`


room1log Process Details
-----------------------
`ps -O lstart,etime,pcpu \`cat /home/person1/dir1/room1log.pid\``


/var/log/room1log/room1log.log (tail -20)
-----------------------------------
`tail -20 /var/log/room1log/room1log.log`


Start Log File ($STARTLOG)
--------------
`cat "$STARTLOG"`


Error Log File ($ERRORLOG)
--------------
`cat "$ERRORLOG"`


Data Directory Contents
-----------------------
`ls -lh "$DATADIR"`


System Uptime
-------------
`uptime`


Disk Utilization
----------------
`df -h`



EOF2

}

Online jeremypv

  • Member
  • **
  • Posts: 914
    • jeremypv.net
Re: intermittent blank mail alert
« Reply #1 on: August 11, 2016, 03:04:19 PM »
search these:

'useless use of cat' < not the root of problem but /may/ help if you are conscious of this
'unix/linux background process'  < probably the root of the problem
jeremypv

Offline adizero

  • Member
  • **
  • Posts: 259
Re: intermittent blank mail alert
« Reply #2 on: August 18, 2016, 06:50:01 PM »
Thanks jeremypv

We found the cause of the problem on network function sa script. Blank email trigger whenever we cut the network.   Could be Wifi signal.