3,10c3
< # Report on world.php or filename as argument 1
<
< mimetype="Content-Type: text/html\\n"
< emailfrom="rmetcalfe@rjmprogramming.com.au"
< emailto="rmetcalfe15@gmail.com"
< emailcc="rmetcalfe@rjmprogramming.com.au"
< emailbcc=""
< subjmiddle="Date ps-ef world.php Report"
---
> # Report on world.php
12,47d4
< filen=""
<
< attachrest="\\n
First First ${subjmiddle} at `date`
| UID | PID | PPID | C | STIME | TTY | TIME | CMD |
`cat date_ps_ef_first.txt | sed '/^/s//| /g' | sed 's/ \{1,\}/<\/td> | /g' | awk '{ t=0; while (getline \$0) { if (t == 0) { print \" |
<\/tr>/g'`
"
< if [ ! -z "$1" ]; then
< while [ ! -z "$1" ]; do
< if [ "`echo \"${1}\" | tr -d '@'`" != "`echo \"${1}\"" ]; then
< if [ "`echo \"${emailto}\" | tr -d ' '`" == "`echo \"${emailto}\"" ]; then
< emailto="${1} "
< elif [ "`echo \"${emailcc}\" | tr -d ' '`" == "`echo \"${emailcc}\"" ]; then
< emailcc="${1} "
< else
< emailbcc="BCC: ${1}\\n"
< fi
< elif [ -f "${1}" ]; then
< if [ ! -z "${mimetype}" ]; then
< filen="${1}"
< mimetype=""
< shortf=""
< basechars="`base64 ${filen} | tr -d \"\\n\"`"
< i=0
< flast="`echo ${1} | tr '/' ' ' | sed '/\\\\/s// /g'`"
< for filebits in ${flast}; do
< shortf=$filebits
< ((i=i+1))
< done
< subjmiddle="$shortf"
< attachrest="Mime-Version: 1.0\\nContent-Type: multipart/mixed; boundary=\"19032019ABCDE\"\\n\\n--19032019ABCDE\\nContent-Type: text/plain; charset=\"iso-8859-1\"\\nContent-Transfer-Encoding: 8bit\\n\\nFirst ${subjmiddle} at `date`\\n\\n--19032019ABCDE\\nContent-Type: application/octet-stream; name=\"${shortf}\";\\nContent-Transfer-Encoding: base64\\nContent-Disposition: attachment;filename=\"${shortf}\"\\n\\n${basechars}\\n--19032019ABCDE--"
< fi
< fi
< shift
< done
< emailfrom="`echo ${emailfrom} | tr -d ' '`"
< emailto="`echo ${emailto} | tr -d ' '`"
< emailcc="`echo ${emailcc} | tr -d ' '`"
< fi
<
49,53c6
< if [ ! -z "${mimetype}" ]; then
< cur="`ps -ef | grep '/world.php' | grep -v 'grep ' | wc -l | tr -d ' '`"
< else
< cur="`ls -l ${filen}`"
< fi
---
> cur="`ps -ef | grep '/world.php' | grep -v 'grep ' | wc -l | tr -d ' '`"
57,63c10,13
< if [ ! -z "${mimetype}" ]; then
< echo "`ps -ef | grep '/world.php' | grep -v 'grep '`" > date_ps_ef_first.txt
< fi
< echo -e "${mimetype}From: ${emailfrom}\nTo: ${emailto}\nCC: ${emailcc}\n${emailbcc}Subject: First ${subjmiddle} at `date`\n${attachrest}" | sendmail -t -f ${emailto}
< if [ ! -z "${mimetype}" ]; then
< attachrest="\\nChanged ${subjmiddle} at `date`
"
< fi
---
> echo "`ps -ef | grep '/world.php' | grep -v 'grep '`" > date_ps_ef_first.txt
> #cat date_ps_ef_first.txt | sendmail -f rmetcalfe15@gmail.com -s "First Date ps-ef world.php Report at `date`" rmetcalfe15@gmail.com
> #echo -e "Content-Type: text/plain\nFrom: rmetcalfe@rjmprogramming.com.au\nto: rmetcalfe15@gmail.com\ncc: rmetcalfe@rjmprogramming.com.au\nSubject: First Date ps-ef world.php Report at `date`\n\n`cat date_ps_ef_first.txt`" | sendmail -t -f rmetcalfe15@gmail.com
> echo -e "Content-Type: text/html\nFrom: rmetcalfe@rjmprogramming.com.au\nto: rmetcalfe15@gmail.com\ncc: rmetcalfe@rjmprogramming.com.au\nSubject: First Date ps-ef world.php Report at `date`\n\nFirst Date ps-ef world.php Report at `date`
| UID | PID | PPID | C | STIME | TTY | TIME | CMD |
`cat date_ps_ef_first.txt | sed '/^/s//| /g' | sed 's/ \{1,\}/<\/td> | /g' | awk '{ t=0; while (getline \$0) { if (t == 0) { print \" |
<\/tr>/g'`
" | sendmail -t -f rmetcalfe15@gmail.com
65,74c15,19
< if [ ! -z "${mimetype}" ]; then
< echo "`ps -ef | grep '/world.php' | grep -v 'grep '`" > date_ps_ef_next.txt
< else
< basechars="`base64 ${filen} | tr -d \"\\n\"`"
< attachrest="Mime-Version: 1.0\\nContent-Type: multipart/mixed; boundary=\"19032019ABCDE\"\\n\\n--19032019ABCDE\\nContent-Type: text/plain; charset=\"iso-8859-1\"\\nContent-Transfer-Encoding: 8bit\\n\\nChanged ${subjmiddle} at `date`\\n\\n--19032019ABCDE\\nContent-Type: application/octet-stream; name=\"${shortf}\";\\nContent-Transfer-Encoding: base64\\nContent-Disposition: attachment;filename=\"${shortf}\"\\n\\n${basechars}\\n--19032019ABCDE--"
< fi
< echo -e "${mimetype}From: ${emailfrom}\nTo: ${emailto}\nCC: ${emailcc}\n${emailbcc}Subject: Changed ${subjmiddle} at `date`\n${attachrest}" | sendmail -t -f ${emailto}
< if [ ! -z "${mimetype}" ]; then
< cat date_ps_ef_next.txt > date_ps_ef_first.txt
< fi
---
> echo "`ps -ef | grep '/world.php' | grep -v 'grep '`" > date_ps_ef_next.txt
> #diff date_ps_ef_first.txt date_ps_ef_next.txt | sendmail -f rmetcalfe15@gmail.com -s "Changed Date ps-ef world.php Report at `date`" rmetcalfe15@gmail.com
> echo -e "Content-Type: text/html\nFrom: rmetcalfe@rjmprogramming.com.au\nto: rmetcalfe15@gmail.com\ncc: rmetcalfe@rjmprogramming.com.au\nSubject: Changed Date ps-ef world.php Report at `date`\n\nChanged Date ps-ef world.php Report at `date`
" | sendmail -t -f rmetcalfe15@gmail.com
>
> cat date_ps_ef_next.txt > date_ps_ef_first.txt
78,82c23
< if [ ! -z "${mimetype}" ]; then
< if [ -z "${mimetype}" ]; then
< ps -ef | grep '/world.php' | grep -v 'grep '
< fi
< fi
---
> # ps -ef | grep '/world.php' | grep -v 'grep '