{"id":49107,"date":"2020-05-27T03:01:12","date_gmt":"2020-05-26T17:01:12","guid":{"rendered":"http:\/\/www.rjmprogramming.com.au\/ITblog\/?p=49107"},"modified":"2020-05-27T20:57:26","modified_gmt":"2020-05-27T10:57:26","slug":"linux-sendmail-nohup-refined-scheduling-tutorial","status":"publish","type":"post","link":"https:\/\/www.rjmprogramming.com.au\/ITblog\/linux-sendmail-nohup-refined-scheduling-tutorial\/","title":{"rendered":"Linux sendmail nohup Refined Scheduling Tutorial"},"content":{"rendered":"<div style=\"width: 230px\" class=\"wp-caption alignnone\"><a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/Mac\/nohup_vs_crontab_refined_scheduling.jpg\"><img decoding=\"async\" style=\"float:left; border: 15px solid pink;\" alt=\"Linux sendmail nohup Refined Scheduling Tutorial\" src=\"http:\/\/www.rjmprogramming.com.au\/Mac\/nohup_vs_crontab_refined_scheduling.jpg\" title=\"Linux sendmail nohup Refined Scheduling Tutorial\"  \/><\/a><p class=\"wp-caption-text\">Linux sendmail nohup Refined Scheduling Tutorial<\/p><\/div>\n<p>Yesterday&#8217;s <a title='Linux sendmail nohup Scheduling Tutorial' href='#lst'>Linux sendmail nohup Scheduling Tutorial<\/a> left us with a Linux (or unix) &#8230;<\/p>\n<blockquote cite='\/\/www.rjmprogramming.com.au\/ITblog\/linux-sendmail-nohup-scheduling-tutorial\/'>\n<ol>\n<li><a target=_blank title='nohup' href='http:\/\/www.computerhope.com\/unix\/unohup.htm'>nohup<\/a><\/li>\n<li>&#8220;&#038;&#8221; background processing<\/li>\n<li><a target=_blank title='Recursion information from Wikipedia ... thanks' href='https:\/\/en.wikipedia.org\/wiki\/Recursion_(computer_science)'>recursion<\/a> (perhaps)<\/li>\n<\/ol>\n<\/blockquote>\n<p> &#8230; scheduling Korn Shell script coding snippet for either &#8230;<\/p>\n<ol>\n<li>one off scheduled process execution &#8230; eg. <font color=red>date_ps_ef.ksh 10:43<\/font> &#8230; or &#8230;<\/li>\n<li>&#8220;daily&#8221; continuous (as long as the server is up) process execution &#8230; eg. <font color=purple>date_ps_ef.ksh 10:-43<\/font><\/li>\n<\/ol>\n<p> &#8230; and today we get even closer to <a target=_blank title='crontab' href='http:\/\/www.computerhope.com\/unix\/ucrontab.htm'>crontab<\/a> with capabilities by adding to &#8220;daily&#8221; scheduling the possibility for &#8220;other time period&#8221; (continuous processing) scheduling.  For example &#8230;<\/p>\n<ul>\n<li><font color=darkgreen>date_ps_ef.ksh 10+1.5:43<\/font> starts at the next &#8220;10:43&#8221; and then every one hour and a half<\/li>\n<li><font color=darkgreen>date_ps_ef.ksh 10+40:43<\/font> starts at the next &#8220;10:43&#8221; and then every forty minutes<\/li>\n<li><font color=darkgreen>date_ps_ef.ksh 10+60:43<\/font> starts at the next &#8220;10:43&#8221; and then every minute (60 seconds)<\/li>\n<\/ul>\n<p>And so, <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/PHP\/Geographicals\/diff.php?one=http:\/\/www.rjmprogramming.com.au\/Mac\/date_ps_ef.ksh------GETME\">the changed<\/a> <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/Mac\/date_ps_ef.ksh------GETME\">date_ps_ef.ksh<\/a> Korn Shell script <font color=olive>new logic parts for non-daily scheduling<\/font> shows below &#8230;<\/p>\n<p><code><br \/>\n   if [ \"`echo \\\"${1}\\\" | sed '\/^0\/s\/\/\/g' | sed '\/^1\/s\/\/\/g' | sed '\/^2\/s\/\/\/g' | sed '\/^3\/s\/\/\/g' | sed '\/^4\/s\/\/\/g' | sed '\/^5\/s\/\/\/g' | sed '\/^6\/s\/\/\/g' | sed '\/^7\/s\/\/\/g' | sed '\/^8\/s\/\/\/g' | sed '\/^9\/s\/\/\/g'`\" != \"`echo \\\"${1}\\\"\" ]; then<br \/>\n   if [ \"`echo \\\"${1}\\\" | sed '\/0$\/s\/\/\/g' | sed '\/1$\/s\/\/\/g' | sed '\/2$\/s\/\/\/g' | sed '\/3$\/s\/\/\/g' | sed '\/4$\/s\/\/\/g' | sed '\/5$\/s\/\/\/g' | sed '\/6$\/s\/\/\/g' | sed '\/7$\/s\/\/\/g' | sed '\/8$\/s\/\/\/g' | sed '\/9$\/s\/\/\/g'`\" != \"`echo \\\"${1}\\\"\" ]; then<br \/>\n    if [ \"`echo \\\"${1}\\\" | sed '\/\\:\/s\/\/\/g'`\" != \"`echo \\\"${1}\\\"\" ]; then<br \/>\n     <font color=olive>pfrom=\"\"<br \/>\n     pto=\"\"<br \/>\n     preadddh=\"\"<br \/>\n     adddh=\"\"<br \/>\n     addh=\"0\"<br \/>\n     addm=\"0\"<br \/>\n     adds=\"0\"<\/font><br \/>\n     twoy=\"\"<br \/>\n     factor=\"1\"<br \/>\n     thsx=\"3600\"<br \/>\n     secstowait=\"0\"<br \/>\n     nowis=\"`date '+%H:%M:%S'`\"<br \/>\n     one=\"${1}\"<br \/>\n     oney=\"${1}\"<br \/>\n     his=\"`echo ${nowis} | cut -f 1 -d ':'`\"<br \/>\n     hfrom=\"`echo ${one}:00 | cut -f 1 -d ':'<font color=olive> | cut -f 1 -d '-' | cut -f 1 -d '+' |<\/font> tr -d '-'`\"<br \/>\n     mis=\"`echo ${nowis} | cut -f 2 -d ':'`\"<br \/>\n     mfrom=\"`echo ${one}:00 | cut -f 2 -d ':' | tr -d '-'<font color=olive> | tr -d '+'<\/font>`\"<br \/>\n     sis=\"`echo ${nowis} | cut -f 3 -d ':'`\"<br \/>\n     sfrom=\"`echo ${one}:00 | cut -f 3 -d ':' | tr -d '-'<font color=olive> | tr -d '+'<\/font>`\"<br \/>\n     if [ \"`echo ${1} | tr -d '-'`\" != \"`echo ${1}`\" ]; then<br \/>\n       twoy=\"`echo ${1} | sed '\/\\:00\\:00\\:00\\:00\/s\/\/\/g'`:00:00:00:00\"<br \/>\n       <font color=olive>if [ \"`echo ${1} | sed '\/\\:\\-\/s\/\/\/g'`\" == \"`echo ${1}`\" ]; then<br \/>\n         preadddh=\"-\"<br \/>\n         adddh=\"`echo \\\"${one}:00\\\" | cut -f 2 -d '-' | cut -f 1 -d ':'`\"<br \/>\n         xadddh=\"`echo \\\"${adddh}\\\" | cut -f 1 -d '.'`\"<br \/>\n         if [ \"`expr ${xadddh} \\&gt;= 24`\" == \"1\" ]; then<br \/>\n            if [ \"`expr ${xadddh} \\&lt; 60`\" == \"1\" ]; then<br \/>\n              thsx=\"60\"<br \/>\n              factor=\"1\"<br \/>\n            else<br \/>\n              thsx=\"1\"<br \/>\n              factor=\"1\"<br \/>\n            fi<br \/>\n         fi<br \/>\n         if [ \"${adddh}\" != \"${xadddh}\" ]; then<br \/>\n          if [ \"`expr ${xadddh} \\&gt;= 24`\" == \"1\" ]; then<br \/>\n            if [ \"`expr ${xadddh} \\&lt; 60`\" == \"1\" ]; then<br \/>\n              thsx=\"60\"<br \/>\n            else<br \/>\n              thsx=\"1\"<br \/>\n            fi<br \/>\n          fi<br \/>\n          zadddh=\"`echo \\\"${adddh}.\\\" | cut -f 2 -d '.'`\"<br \/>\n          zlen=\"`echo \\\"${zadddh}\\\" | tr -d ' ' | wc -c | tr -d ' '`\"<br \/>\n          if [ \"${zlen}\" == \"0\" -o \"${thsx}\" == \"1\" ]; then<br \/>\n             factor=\"1\"<br \/>\n          elif [ \"${zlen}\" == \"1\" -o \"${thsx}\" == \"1\" ]; then<br \/>\n             factor=\"1\"<br \/>\n          elif [ \"${zlen}\" == \"2\" -o \"${thsx}\" == \"60\" ]; then<br \/>\n             factor=\"10\"<br \/>\n             xadddh=\"`echo ${xadddh}${zadddh:0:1}`\"<br \/>\n          elif [ \"${zlen}\" == \"3\" ]; then<br \/>\n             factor=\"100\"<br \/>\n             xadddh=\"`echo ${xadddh}${zadddh:0:2}`\"<br \/>\n          else<br \/>\n             factor=\"100\"<br \/>\n             xadddh=\"`echo ${xadddh}${zadddh:0:2}`\"<br \/>\n          fi<br \/>\n         fi<br \/>\n         if [ ! -z \"${adddh}\" ]; then<br \/>\n           addh=\"`echo \\\"0${adddh}\\\" | cut -f 1 -d '.'`\"<br \/>\n           if [ \"$thsx\" == \"1\" ]; then<br \/>\n             addh=\"`expr $xadddh \\\\\/ 3600`\"<br \/>\n           elif [ \"$thsx\" == \"60\" ]; then<br \/>\n             addh=\"`expr $xadddh \\\\\/ 60`\"<br \/>\n           fi<br \/>\n           adds=\"`expr ${xadddh} \\\\* ${thsx} \\\\\/ ${factor}`\"<br \/>\n           adds=\"`echo \\\"${adds}\\\" | cut -f 1 -d '.'`\"<br \/>\n           adds=\"`expr ${adds} - ${addh} \\\\* 3600`\"<br \/>\n           addm=\"`expr ${adds} \\\\\/ 60`\"<br \/>\n           addm=\"`echo \\\"${addm}\\\" | cut -f 1 -d '.'`\"<br \/>\n           adds=\"`expr ${adds} - ${addm} \\\\* 60`\"<br \/>\n           pfrom=\"${1}\"<br \/>\n           pto=\"${1}\"<br \/>\n         fi<br \/>\n       fi<\/font><br \/>\n     <font color=olive>elif [ \"`echo ${1} | tr -d '+'`\" != \"`echo ${1}`\" ]; then<br \/>\n       twoy=\"`echo ${1} | sed '\/\\:00\\:00\\:00\\:00\/s\/\/\/g'`:00:00:00:00\"<br \/>\n       if [ \"`echo ${1} | sed '\/\\:\\+\/s\/\/\/g'`\" == \"`echo ${1}`\" ]; then<br \/>\n         preadddh=\"+\"<br \/>\n         adddh=\"`echo \\\"${one}:00\\\" | cut -f 2 -d '+' | cut -f 1 -d ':'`\"<br \/>\n         xadddh=\"`echo \\\"${adddh}\\\" | cut -f 1 -d '.'`\"<br \/>\n         if [ \"`expr ${xadddh} \\&gt;= 24`\" == \"1\" ]; then<br \/>\n            if [ \"`expr ${xadddh} \\&lt; 60`\" == \"1\" ]; then<br \/>\n              thsx=\"60\"<br \/>\n              factor=\"1\"<br \/>\n            else<br \/>\n              thsx=\"1\"<br \/>\n              factor=\"1\"<br \/>\n            fi<br \/>\n         fi<br \/>\n         if [ \"${adddh}\" != \"${xadddh}\" ]; then<br \/>\n          if [ \"`expr ${xadddh} \\&gt;= 24`\" == \"1\" ]; then<br \/>\n            if [ \"`expr ${xadddh} \\&lt; 60`\" == \"1\" ]; then<br \/>\n              thsx=\"60\"<br \/>\n            else<br \/>\n              thsx=\"1\"<br \/>\n            fi<br \/>\n          fi<br \/>\n          zadddh=\"`echo \\\"${adddh}.\\\" | cut -f 2 -d '.'`\"<br \/>\n          zlen=\"`echo \\\"${zadddh}\\\" | tr -d ' ' | wc -c | tr -d ' '`\"<br \/>\n          if [ \"${zlen}\" == \"0\" -o \"${thsx}\" == \"1\" ]; then<br \/>\n             factor=\"1\"<br \/>\n          elif [ \"${zlen}\" == \"1\" -o \"${thsx}\" == \"1\" ]; then<br \/>\n             factor=\"1\"<br \/>\n          elif [ \"${zlen}\" == \"2\" -o \"${thsx}\" == \"60\" ]; then<br \/>\n             factor=\"10\"<br \/>\n             xadddh=\"`echo ${xadddh}${zadddh:0:1}`\"<br \/>\n          elif [ \"${zlen}\" == \"3\" ]; then<br \/>\n             factor=\"100\"<br \/>\n             xadddh=\"`echo ${xadddh}${zadddh:0:2}`\"<br \/>\n          else<br \/>\n             factor=\"100\"<br \/>\n             xadddh=\"`echo ${xadddh}${zadddh:0:2}`\"<br \/>\n          fi<br \/>\n         fi<br \/>\n         if [ ! -z \"${adddh}\" ]; then<br \/>\n           addh=\"`echo \\\"0${adddh}\\\" | cut -f 1 -d '.'`\"<br \/>\n           if [ \"$thsx\" == \"1\" ]; then<br \/>\n             addh=\"`expr $xadddh \\\\\/ 3600`\"<br \/>\n           elif [ \"$thsx\" == \"60\" ]; then<br \/>\n             addh=\"`expr $xadddh \\\\\/ 60`\"<br \/>\n           fi<br \/>\n           adds=\"`expr ${xadddh} \\\\* ${thsx} \\\\\/ ${factor}`\"<br \/>\n           adds=\"`echo \\\"${adds}\\\" | cut -f 1 -d '.'`\"<br \/>\n           adds=\"`expr ${adds} - ${addh} \\\\* 3600`\"<br \/>\n           addm=\"`expr ${adds} \\\\\/ 60`\"<br \/>\n           addm=\"`echo \\\"${addm}\\\" | cut -f 1 -d '.'`\"<br \/>\n           adds=\"`expr ${adds} - ${addm} \\\\* 60`\"<br \/>\n           pfrom=\"${1}\"<br \/>\n           pto=\"${1}\"<br \/>\n         fi<br \/>\n       fi<\/font><br \/>\n     fi<br \/>\n     if [ ! -z \"${preTZ}\" -o ! -z \"${adddh}\" ]; then<br \/>\n       bnowis=\"`date '+%H:%M'`\"<br \/>\n       <font color=olive>if [ -z \"${preTZ}\" ]; then<br \/>\n       ccnowis=\"`date '+%H:%M:%S'`\"<br \/>\n       cnowis=\"`date '+%H:%M'`\"<br \/>\n       else<\/font><br \/>\n       ccnowis=\"`TZ=${preTZ} date '+%H:%M:%S'`\"<br \/>\n       cnowis=\"`TZ=${preTZ} date '+%H:%M'`\"<br \/>\n       <font color=olive>fi<\/font><br \/>\n       if [ \"`echo ${nowis} | sed '\/${cnowis}\/s\/\/\/g'`\" == \"`echo ${nowis}`\"<font color=olive> -o ! -z \"${adddh}\"<\/font> ]; then<br \/>\n         chis=\"`echo ${cnowis}:00 | cut -f 1 -d ':'`\"<br \/>\n         cmis=\"`echo ${cnowis}:00 | cut -f 2 -d ':'`\"<br \/>\n         csis=\"`echo ${ccnowis}:00 | cut -f 3 -d ':'`\"<br \/>\n<br \/> <br \/>\n         <font color=olive>if [ ! -z \"${adddh}\" ]; then<br \/>\n           news=\"`expr ${sfrom} + ${adds}`\"<br \/>\n           if [ \"`expr ${news} \\&lt; 60`\" == \"1\" ]; then<br \/>\n            newm=\"`expr ${mfrom} + ${addm}`\"<br \/>\n           else<br \/>\n            news=\"`expr ${news} - 60`\"<br \/>\n            newm=\"`expr ${mfrom} + ${addm} + 1`\"<br \/>\n           fi<br \/>\n           if [ \"`expr ${newm} \\&lt; 60`\" == \"1\" ]; then<br \/>\n            newh=\"`expr ${hfrom} + ${addh}`\"<br \/>\n           else<br \/>\n            newm=\"`expr ${newm} - 60`\"<br \/>\n            newh=\"`expr ${hfrom} + ${addh} + 1`\"<br \/>\n           fi<br \/>\n           if [ \"`expr ${newh} \\&gt;= 24`\" == \"1\" ]; then<br \/>\n            newh=\"`expr ${newh} - 24`\"<br \/>\n           fi<br \/>\n           pto=\"${newh}${preadddh}${adddh}:${newm}:${news}\"<br \/>\n         fi<\/font><br \/>\n<br \/> <br \/>\n         <font color=olive>#one=\"`expr ${chis} - ${his} + ${hfrom} + ${addh}`:`expr ${cmis} - ${mis} + ${mfrom} + ${addm}`:`expr ${csis} - ${sis} + ${sfrom} + ${adds}`\"<\/font><br \/>\n         one=\"`expr ${chis} - ${his} + ${hfrom}`:`expr ${cmis} - ${mis} + ${mfrom}`:`expr ${csis} - ${sis} + ${sfrom}`\"<br \/>\n<br \/> <br \/>\n         hfrom=\"`echo ${one}:00 | cut -f 1 -d ':' | cut -f 1 -d '-' | cut -f 1 -d '+' | tr -d '-'`\"<br \/>\n         mfrom=\"`echo ${one}:00 | cut -f 2 -d ':' | cut -f 1 -d '-' | cut -f 1 -d '+' | tr -d '-'`\"<br \/>\n         sfrom=\"`echo ${one}:00 | cut -f 3 -d ':' | cut -f 1 -d '-' | cut -f 1 -d '+' | tr -d '-'`\"<br \/>\n<br \/> <br \/>\n         his=\"`echo ${cnowis}:00 | cut -f 1 -d ':'`\"<br \/>\n         mis=\"`echo ${cnowis}:00 | cut -f 2 -d ':'`\"<br \/>\n         sis=\"`echo ${ccnowis}:00 | cut -f 3 -d ':'`\"<br \/>\n         nowis=\"${ccnowis}\"<br \/>\n       fi<br \/>\n     else<br \/>\n       bnowis=\"`date '+%H:%M'`\"<br \/>\n       cnowis=\"`date '+%H:%M'`\"<br \/>\n     fi<br \/>\n     if [ \"`expr ${hfrom} - ${his} \\&lt;= 0`\" == \"1\" ]; then<br \/>\n     #echo \"Time found ${one} versus ${nowis} ... `expr ${hfrom} - ${his}`\"<br \/>\n     if [ \"`expr ${hfrom} - ${his} \\&lt; 0`\" == \"1\" ]; then<br \/>\n     hfrom=\"`expr ${hfrom} + 24`\"<br \/>\n     else<br \/>\n<br \/> <br \/>\n     if [ \"`expr ${mfrom} - ${mis} \\&lt;= 0`\" == \"1\" ]; then<br \/>\n     if [ \"`expr ${mfrom} - ${mis} \\&lt; 0`\" == \"1\" ]; then<br \/>\n     hfrom=\"`expr ${hfrom} + 24`\"<br \/>\n     else<br \/>\n<br \/> <br \/>\n     if [ \"`expr ${sfrom} - ${sis} \\&lt;= 0`\" == \"1\" ]; then<br \/>\n     if [ \"`expr ${sfrom} - ${sis} \\&lt; 0`\" == \"1\" ]; then<br \/>\n     hfrom=\"`expr ${hfrom} + 24`\"<br \/>\n     fi<br \/>\n     fi<br \/>\n<br \/> <br \/>\n     fi<br \/>\n     fi<br \/>\n<br \/> <br \/>\n     fi<br \/>\n     fi<br \/>\n     curpid=\"$$\"<br \/>\n     precmdline=\"`ps -p ${curpid} -o args | sed '\/^ARGS\/s\/\/\/g' | sed '\/^ksh \/s\/\/\/g' | tr -d \\\"\\n\\\"`\"<br \/>\n     if [ -z \"${twoy}\" ]; then<br \/>\n     cmdline=`echo ${precmdline} | awk -v FS=\"${1}\" '{ print $1 $2;  }'`<br \/>\n     else<br \/>\n     rtd=\"`echo ${1} | sed '\/\\:00\\:00\\:00\\:00\/s\/\/\/g'`\"<br \/>\n     cmdline=\"`echo ${precmdline} | awk -v FS=\"${rtd}\" '{ print $1 FS \\\":00:00:00:00\\\" $2;  }'`\"<br \/>\n     <font color=olive>cmdline=\"`echo ${cmdline} | sed \\\"\/${1}:00:00:00:00${1}:00:00:00:00\/s\/\/${1}:00:00:00:00\/g\\\" | sed \\\"\/${1}${1}\/s\/\/${1}\/g\\\"`\"<\/font><br \/>\n     fi<br \/>\n     <font color=olive>cmdline=\"`echo ${cmdline} | sed '\/\\:00\\:00\\:00\\:00\\:00\\:00\\:00\\:00\/s\/\/\\:00\\:00\\:00\\:00\/g'`\"<\/font><br \/>\n     <font color=olive>if [ ! -z \"${pfrom}\" -a ! -z \"${pto}\" ]; then<br \/>\n     if [ ! -z \"${pto}\" -a \"`echo \\\"${cmdline}\\\" | sed '\/\\:00\\:00\\:00\\:00\\:00\\:00\\:00\\:00\/s\/\/\/g'`\" == \"`echo \\\"${cmdline}\\\"`\" ]; then<br \/>\n       cmdline=\"`echo ${cmdline} | sed \\\"\/${pfrom}\/s\/\/${pto}:00:00:00:00\/g\\\"`\"<br \/>\n     else<br \/>\n       cmdline=\"`echo ${cmdline} | sed \\\"\/${pfrom}\/s\/\/${pto}\/g\\\"`\"<br \/>\n     fi<br \/>\n     fi<\/font><br \/>\n     secstowait=\"`expr ${hfrom} - ${his}`\"<br \/>\n     secstowait=\"`expr ${secstowait} \\\\* 3600`\"<br \/>\n     stowait=\"`expr ${mfrom} - ${mis}`\"<br \/>\n     stowait=\"`expr ${stowait} \\\\* 60`\"<br \/>\n     secstowait=\"`expr ${stowait} +  ${secstowait}`\"<br \/>\n     stowait=\"`expr ${sfrom} - ${sis}`\"<br \/>\n     secstowait=\"`expr ${stowait} +  ${secstowait}`\"<br \/>\n     if [ ! -z \"${twoy}\" ]; then<br \/>\n      secstowait=\"`expr 1 +  ${secstowait}`\"<br \/>\n     fi<br \/>\n     <font color=olive>cmdline=\"`echo ${cmdline} | sed '\/\\:00\\:00\\:00\\:00\\:00\\:00\\:00\\:00\/s\/\/\\:00\\:00\\:00\\:00\/g'`\"<\/font><br \/>\n     #echo \"TIME found ${1} versus ${nowis} ... `expr ${hfrom} - ${his}` ... ${secstowait} ... ${cmdline} ... ${nowis} ... ${cnowis} ... sleep ${secstowait}; `echo ${cmdline}`  nohup ksh -c \\\"sleep ${secstowait} ; cd \\\\\\\"`pwd`\\\\\\\" ;  `echo ${cmdline}` ;\\\" &gt; \/dev\/null 2&gt; \/dev\/null\"<br \/>\n     nohup ksh -c \"sleep ${secstowait} ; cd \\\"`pwd`\\\" ; ksh `echo ${cmdline}` ;\" &gt; \/dev\/null 2&gt;&gt; \/dev\/null &<br \/>\n     if [ \"`echo ${1} | sed '\/\\:00\\:00\\:00\\:00\/s\/\/\/g'`\" == \"`echo ${1}`\" ]; then<br \/>\n       exit<br \/>\n     fi<br \/>\n    else<br \/>\n     ppid=\"${1}\"<br \/>\n     #if [ \"`ps -ef | grep ' ${1} ' | grep -v 'grep'`\" ]; then<br \/>\n     #  exit<br \/>\n     #fi<br \/>\n    fi<br \/>\n   fi<br \/>\n   fi<br \/>\n<\/code><\/p>\n<p><!--p>You can also see this play out at WordPress 4.1.1's <a target=_blank  href='\/\/www.rjmprogramming.com.au\/ITblog\/linux-sendmail-nohup-refined-scheduling-tutorial\/'>Linux sendmail nohup Refined Scheduling Tutorial<\/a>.<\/p-->\n<hr>\n<p id='lst'>Previous relevant <a target=_blank title='Linux sendmail nohup Scheduling Tutorial' href='\/\/www.rjmprogramming.com.au\/ITblog\/linux-sendmail-nohup-scheduling-tutorial\/'>Linux sendmail nohup Scheduling Tutorial<\/a> is shown below.<\/p>\n<div style=\"width: 230px\" class=\"wp-caption alignnone\"><a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/Mac\/nohup_vs_crontab_scheduling.jpg\"><img decoding=\"async\" style=\"float:left; border: 15px solid pink;\" alt=\"Linux sendmail nohup Scheduling Tutorial\" src=\"http:\/\/www.rjmprogramming.com.au\/Mac\/nohup_vs_crontab_scheduling.jpg\" title=\"Linux sendmail nohup Scheduling Tutorial\"  \/><\/a><p class=\"wp-caption-text\">Linux sendmail nohup Scheduling Tutorial<\/p><\/div>\n<p>As far as Linux or unix operating systems (for web servers) go for &#8220;scheduling processes&#8221;, it is &#8230;<\/p>\n<ul>\n<li>great if you have access to <a target=_blank title='crontab' href='http:\/\/www.computerhope.com\/unix\/ucrontab.htm'>crontab<\/a> because it can be &#8230;\n<ol>\n<li>scheduled to the minute<\/li>\n<li>the actions can be repeated (and scheduled) in a hugely different number of ways<\/li>\n<li>starts up again on a reboot of the (web) server (in a normal arrangement)<\/li>\n<ol>\n<\/li>\n<li>but less formalized can be a simple (Korn (in our case)) shell scripting procedure that involves &#8230;\n<ol>\n<li><a target=_blank title='nohup' href='http:\/\/www.computerhope.com\/unix\/unohup.htm'>nohup<\/a><\/li>\n<li>&#8220;&#038;&#8221; background processing<\/li>\n<li><a target=_blank title='Recursion information from Wikipedia ... thanks' href='https:\/\/en.wikipedia.org\/wiki\/Recursion_(computer_science)'>recursion<\/a> (perhaps)<\/li>\n<\/ol>\n<\/li>\n<\/ul>\n<p> &#8230; the latter representing an idea you have for either (eg. timed for 10:43) &#8230;<\/p>\n<ul>\n<li>a one off scheduled procedure &#8230; eg. <font color=red>date_ps_ef.ksh 10:43<\/font> &#8230; for next 10:43 (local time if locally executed (as we tested here on <a target=_blank title='MAMP Mac Apache\/PHP\/MySql local web server' href='http:\/\/www.mamp.info\/'>MAMP<\/a>, and mapped times via informing the script of the timezone of the destination web server as per &#8230;<br \/>\n<code><br \/>\n<font color=red># Local time the Korn Shell will be hosted at<br \/>\npreTZ=\"Australia\/Perth\"<\/font><br \/>\nthispid=\"`echo $$`\"<br \/>\npostiftwoquit=\"`ps -ef | grep \\\" ${thispid} \\\" | grep -c ':00:00:00:00'`\"<br \/>\niftwoquit=\"1\"<br \/>\n<\/code><br \/>\n &#8230; or web server time) &#8230; or &#8230;<\/li>\n<li>a daily scheduled procedure &#8230; eg. <font color=purple>date_ps_ef.ksh 10:-43<\/font><\/li>\n<\/ul>\n<p> &#8230; <font color=purple>via<\/font> &#8230;<\/p>\n<p><code><br \/>\n   if [ \"`echo \\\"${1}\\\" | sed '\/^0\/s\/\/\/g' | sed '\/^1\/s\/\/\/g' | sed '\/^2\/s\/\/\/g' | sed '\/^3\/s\/\/\/g' | sed '\/^4\/s\/\/\/g' | sed '\/^5\/s\/\/\/g' | sed '\/^6\/s\/\/\/g' | sed '\/^7\/s\/\/\/g' | sed '\/^8\/s\/\/\/g' | sed '\/^9\/s\/\/\/g'`\" != \"`echo \\\"${1}\\\"\" ]; then<br \/>\n   if [ \"`echo \\\"${1}\\\" | sed '\/0$\/s\/\/\/g' | sed '\/1$\/s\/\/\/g' | sed '\/2$\/s\/\/\/g' | sed '\/3$\/s\/\/\/g' | sed '\/4$\/s\/\/\/g' | sed '\/5$\/s\/\/\/g' | sed '\/6$\/s\/\/\/g' | sed '\/7$\/s\/\/\/g' | sed '\/8$\/s\/\/\/g' | sed '\/9$\/s\/\/\/g'`\" != \"`echo \\\"${1}\\\"\" ]; then<br \/>\n    if [ \"`echo \\\"${1}\\\" | sed '\/\\:\/s\/\/\/g'`\" != \"`echo \\\"${1}\\\"\" ]; then<br \/>\n     twoy=\"\"<br \/>\n     secstowait=\"0\"<br \/>\n     nowis=\"`date '+%H:%M:%S'`\"<br \/>\n     one=\"${1}\"<br \/>\n     oney=\"${1}\"<br \/>\n     if [ \"`echo ${1} | tr -d '-'`\" != \"`echo ${1}`\" ]; then<br \/>\n       twoy=\"`echo ${1} | sed '\/\\:00\\:00\\:00\\:00\/s\/\/\/g'`:00:00:00:00\"<br \/>\n     fi<br \/>\n     his=\"`echo ${nowis} | cut -f 1 -d ':'`\"<br \/>\n     hfrom=\"`echo ${one}:00 | cut -f 1 -d ':' | tr -d '-'`\"<br \/>\n     mis=\"`echo ${nowis} | cut -f 2 -d ':'`\"<br \/>\n     mfrom=\"`echo ${one}:00 | cut -f 2 -d ':' | tr -d '-'`\"<br \/>\n     sis=\"`echo ${nowis} | cut -f 3 -d ':'`\"<br \/>\n     sfrom=\"`echo ${one}:00 | cut -f 3 -d ':' | tr -d '-'`\"<br \/>\n     if [ ! -z \"${preTZ}\" ]; then<br \/>\n       bnowis=\"`date '+%H:%M'`\"<br \/>\n       ccnowis=\"`TZ=${preTZ} date '+%H:%M:%S'`\"<br \/>\n       cnowis=\"`TZ=${preTZ} date '+%H:%M'`\"<br \/>\n       if [ \"`echo ${nowis} | sed '\/${cnowis}\/s\/\/\/g'`\" == \"`echo ${nowis}`\" ]; then<br \/>\n         chis=\"`echo ${cnowis}:00 | cut -f 1 -d ':'`\"<br \/>\n         cmis=\"`echo ${cnowis}:00 | cut -f 2 -d ':'`\"<br \/>\n         csis=\"`echo ${ccnowis}:00 | cut -f 3 -d ':'`\"<br \/>\n<br \/> <br \/>\n         one=\"`expr ${chis} - ${his} + ${hfrom}`:`expr ${cmis} - ${mis} + ${mfrom}`:`expr ${csis} - ${sis} + ${sfrom}`\"<br \/>\n<br \/> <br \/>\n         hfrom=\"`echo ${one}:00 | cut -f 1 -d ':' | tr -d '-'`\"<br \/>\n         mfrom=\"`echo ${one}:00 | cut -f 2 -d ':' | tr -d '-'`\"<br \/>\n         sfrom=\"`echo ${one}:00 | cut -f 3 -d ':' | tr -d '-'`\"<br \/>\n<br \/> <br \/>\n         his=\"`echo ${cnowis}:00 | cut -f 1 -d ':'`\"<br \/>\n         mis=\"`echo ${cnowis}:00 | cut -f 2 -d ':'`\"<br \/>\n         sis=\"`echo ${ccnowis}:00 | cut -f 3 -d ':'`\"<br \/>\n         nowis=\"${ccnowis}\"<br \/>\n       fi<br \/>\n     else<br \/>\n       bnowis=\"`date '+%H:%M'`\"<br \/>\n       cnowis=\"`date '+%H:%M'`\"<br \/>\n     fi<br \/>\n     if [ \"`expr ${hfrom} - ${his} \\&lt;= 0`\" == \"1\" ]; then<br \/>\n     #echo \"Time found ${one} versus ${nowis} ... `expr ${hfrom} - ${his}`\"<br \/>\n     if [ \"`expr ${hfrom} - ${his} \\&lt; 0`\" == \"1\" ]; then<br \/>\n     hfrom=\"`expr ${hfrom} + 24`\"<br \/>\n     else<br \/>\n<br \/> <br \/>\n     if [ \"`expr ${mfrom} - ${mis} \\&lt;= 0`\" == \"1\" ]; then<br \/>\n     if [ \"`expr ${mfrom} - ${mis} \\&lt; 0`\" == \"1\" ]; then<br \/>\n     hfrom=\"`expr ${hfrom} + 24`\"<br \/>\n     else<br \/>\n<br \/> <br \/>\n     if [ \"`expr ${sfrom} - ${sis} \\&lt;= 0`\" == \"1\" ]; then<br \/>\n     if [ \"`expr ${sfrom} - ${sis} \\&lt; 0`\" == \"1\" ]; then<br \/>\n     hfrom=\"`expr ${hfrom} + 24`\"<br \/>\n     fi<br \/>\n     fi<br \/>\n<br \/> <br \/>\n     fi<br \/>\n     fi<br \/>\n<br \/> <br \/>\n     fi<br \/>\n     fi<br \/>\n     curpid=\"$$\"<br \/>\n     precmdline=\"`ps -p ${curpid} -o args | sed '\/^ARGS\/s\/\/\/g' | sed '\/^ksh \/s\/\/\/g' | tr -d \\\"\\n\\\"`\"<br \/>\n     if [ -z \"${twoy}\" ]; then<br \/>\n     cmdline=`echo ${precmdline} | awk -v FS=\"${1}\" '{ print $1 $2;  }'`<br \/>\n     else<br \/>\n     rtd=\"`echo ${1} | sed '\/\\:00\\:00\\:00\\:00\/s\/\/\/g'`\"<br \/>\n     cmdline=\"`echo ${precmdline} | awk -v FS=\"${rtd}\" '{ print $1 FS \\\":00:00:00:00\\\" $2;  }'`\"<br \/>\n     fi<br \/>\n     cmdline=\"`echo ${cmdline} | sed '\/\\:00\\:00\\:00\\:00\\:00\\:00\\:00\\:00\/s\/\/\\:00\\:00\\:00\\:00\/g'`\"<br \/>\n     secstowait=\"`expr ${hfrom} - ${his}`\"<br \/>\n     secstowait=\"`expr ${secstowait} \\\\* 3600`\"<br \/>\n     stowait=\"`expr ${mfrom} - ${mis}`\"<br \/>\n     stowait=\"`expr ${stowait} \\\\* 60`\"<br \/>\n     secstowait=\"`expr ${stowait} +  ${secstowait}`\"<br \/>\n     stowait=\"`expr ${sfrom} - ${sis}`\"<br \/>\n     secstowait=\"`expr ${stowait} +  ${secstowait}`\"<br \/>\n     if [ ! -z \"${twoy}\" ]; then<br \/>\n      secstowait=\"`expr 1 +  ${secstowait}`\"<br \/>\n     fi<br \/>\n     #echo \"TIME found ${1} versus ${nowis} ... `expr ${hfrom} - ${his}` ... ${secstowait} ... ${cmdline} ... ${nowis} ... ${cnowis} ... sleep ${secstowait}; `echo ${cmdline}`  nohup ksh -c \\\"sleep ${secstowait} ; cd \\\\\\\"`pwd`\\\\\\\" ;  `echo ${cmdline}` ;\\\" &gt; \/dev\/null 2&gt; \/dev\/null\"<br \/>\n     nohup ksh -c \"sleep ${secstowait} ; cd \\\"`pwd`\\\" ; ksh `echo ${cmdline}` ;\" &gt; \/dev\/null 2&gt;&gt; \/dev\/null &<br \/>\n     if [ \"`echo ${1} | sed '\/\\:00\\:00\\:00\\:00\/s\/\/\/g'`\" == \"`echo ${1}`\" ]; then<br \/>\n       exit<br \/>\n     fi<br \/>\n    else<br \/>\n     ppid=\"${1}\"<br \/>\n     #if [ \"`ps -ef | grep ' ${1} ' | grep -v 'grep'`\" ]; then<br \/>\n     #  exit<br \/>\n     #fi<br \/>\n    fi<br \/>\n   fi<br \/>\n   fi<br \/>\n<\/code><\/p>\n<p> &#8230; adding that &#8220;scheduling layer&#8221; capability on top of the progress of <a title='Linux sendmail Remote Attachment Tutorial' href='#lrat'>Linux sendmail Remote Attachment Tutorial<\/a> below.<\/p>\n<p>In effect, <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/PHP\/Geographicals\/diff.php?one=http:\/\/www.rjmprogramming.com.au\/Mac\/date_ps_ef.ksh-----GETME\">the changed<\/a> <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/Mac\/date_ps_ef.ksh-----GETME\">date_ps_ef.ksh<\/a> Korn Shell script, on the user defining &#8230;<\/p>\n<ul>\n<li>an argument of the &#8220;hh:mm&#8221; form (or &#8220;hh:-mm&#8221; daily repeated form) will &#8230;<\/li>\n<li>calculate the number of seconds (eg. ${secstowait} below) until &#8220;hh:mm&#8221; next happens &#8230;<\/li>\n<li>\n<code><br \/>\n     nohup ksh -c \"sleep ${secstowait} ; cd \\\"`pwd`\\\" ; ksh `echo ${cmdline}` ;\" &gt; \/dev\/null 2&gt;&gt; \/dev\/null &<br \/>\n<\/code><br \/>\n &#8230; that &#8230;<br \/>\n<code><br \/>\n     if [ ! -z \"${twoy}\" ]; then<br \/>\n      secstowait=\"`expr 1 +  ${secstowait}`\"<br \/>\n     fi<br \/>\n<\/code><br \/>\n &#8230; conditionally causing the one second overshoot on <font color=purple>date_ps_ef.ksh 10:-43<\/font> daily scheduling that will ensure a huge (around about 86400 (seconds in a day) ${secstowait}) &#8220;sleep&#8221; before the next call &#8230;<\/li>\n<li>and in the case of one of those <font color=purple>date_ps_ef.ksh 10:-43<\/font> daily scheduling calls parents will exit when a child starts running for real<\/li>\n<\/ul>\n<p> &#8230; being a methodology getting towards the <a target=_blank title='crontab' href='http:\/\/www.computerhope.com\/unix\/ucrontab.htm'>crontab<\/a> ideal (but will not resurrect itself on a system reboot, unless you script for it), and you can get the gist of by examining today&#8217;s <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/Mac\/nohup_vs_crontab_scheduling.jpg\" title=\"Tutorial picture\">tutorial picture<\/a> of a Korn Shell via nohup scheduling execution.<\/p>\n<p><!--p>You can also see this play out at WordPress 4.1.1's <a target=_blank  href='\/\/www.rjmprogramming.com.au\/ITblog\/linux-sendmail-nohup-scheduling-tutorial\/'>Linux sendmail nohup Scheduling Tutorial<\/a>.<\/p-->\n<hr>\n<p id='lrat'>Previous relevant <a target=_blank title='Linux sendmail Remote Attachment Tutorial' href='\/\/www.rjmprogramming.com.au\/ITblog\/linux-sendmail-remote-attachment-tutorial\/'>Linux sendmail Remote Attachment Tutorial<\/a> is shown below.<\/p>\n<div style=\"width: 230px\" class=\"wp-caption alignnone\"><a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/Mac\/sendmail_command_line_mime_type.jpg\"><img decoding=\"async\" style=\"float:left; border: 15px solid pink;\" alt=\"Linux sendmail Remote Attachment Tutorial\" src=\"http:\/\/www.rjmprogramming.com.au\/Mac\/sendmail_command_line_mime_type_elsewhere.jpg\" title=\"Linux sendmail Remote Attachment Tutorial\"  \/><\/a><p class=\"wp-caption-text\">Linux sendmail Remote Attachment Tutorial<\/p><\/div>\n<p>Programming&#8217;s full of shells of functionality.  And the way you may approach adding functionality to desktop (command line) applications such as the Korn Shell Script one featuring in yesterday&#8217;s <a title='Linux sendmail Mime Type Attachment Tutorial' href='#lmtat'>Linux sendmail Mime Type Attachment Tutorial<\/a> could go a bit like &#8230;<\/p>\n<ul>\n<li>we&#8217;ve written logic for the attachment of <i>local<\/i> media files attached to emails and sent off via Linux sendmail &#8230; <br \/>\nso why not today write functionality to cater for <i>remote<\/i> media file\/URLs (where allowed, that is &#8230; via &#8230;<br \/>\n<code><br \/>\n    filen=\"`echo \\\"${1}\\\" | sed '\/^https:\/s\/\/http:\/g' | sed '\/^HTTPS:\/s\/\/http:\/g' | sed '\/^Https:\/s\/\/http:\/g'\"<br \/>\n    cfilen=\"`<a target=_blank title='Linux or unix curl information from computerhope' href='http:\/\/www.computerhope.com\/unix\/curl.htm'>curl<\/a> ${filen}`\"<br \/>\n    basechars=\"`echo -n \\\"${cfilen}\\\" | base64 | tr -d \\\"\\\\n\\\"`\"<br \/>\n<\/code><br \/>\n)<\/li>\n<li>in the &#8220;body&#8221; section part of the email above the attachment we&#8217;ve written functionality for <i>Content-Type: text\/plain<\/i> &#8230; <br \/> <br \/>\nso why not today write functionality to cater for <i>Content-Type: text\/html<\/i> here (if allowed &#8230; spoiler alert &#8230; yes, it is &#8230; we tried some, and it worked, and we do this when a user defines their own tailored email subject, as talked about below)<\/li>\n<li>we&#8217;ve written functionality for a single file execution via a single relevant <i>command line argument<\/i> &#8230; <br \/> <br \/>\nso why not today write functionality to cater for multiple file executions via a wildcard file specification &#8230; for example &#8230;<br \/>\n<code><br \/>\nksh date_ps_ef.ksh Mac\/SQLite*.jpg &gt; \/dev\/null 2&gt; \/dev\/null &amp;<br \/>\n<\/code><br \/>\n &#8230; or to use a larger (ie. via HTML h1 element) on the body section text on top of the attachment &#8230;<br \/>\n<code><br \/>\nksh date_ps_ef.ksh \"A List of Images ... [file]\" Mac\/SQLite*.jpg &gt; \/dev\/null 2&gt; \/dev\/null &amp;<br \/>\n<\/code><br \/>\n &#8230; or space delimited list of files <i>command line argument<\/i> (if allowed &#8230; spoiler alert &#8230; yes, we can do that)<\/li>\n<li>we&#8217;ve written functionality for email subjects to a pattern with prefix <i>First<\/i> or <i>Changed<\/i> and suffix <i>at [datetimestamp]<\/i> &#8230; <br \/> <br \/>\nso why not today write functionality to cater for <i>user defined subject content<\/i> here (if user uses a double quote delimited argument with one space or more, and substitutional for the token strings <i>[date]<\/i> or <i>[file]<\/i>)<\/li>\n<\/ul>\n<p>Hopefully that sounds interesting, and promising to you too, in which case you might want to examine <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/PHP\/Geographicals\/diff.php?one=http:\/\/www.rjmprogramming.com.au\/Mac\/date_ps_ef.ksh----GETME\">the changed<\/a> <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/Mac\/date_ps_ef.ksh----GETME\">date_ps_ef.ksh<\/a> Korn Shell script by downloading it and implementing it yourself, perhaps.<\/p>\n<p><!--p>You can also see this play out at WordPress 4.1.1's <a target=_blank  href='\/\/www.rjmprogramming.com.au\/ITblog\/new-linux-sendmail-mime-type-attachment-tutorial\/'>New Linux sendmail Mime Type Attachment Tutorial<\/a>.<\/p-->\n<hr>\n<p id='lmtat'>Previous relevant <a target=_blank title='Linux sendmail Mime Type Attachment Tutorial' href='\/\/www.rjmprogramming.com.au\/ITblog\/linux-sendmail-mime-type-attachment-tutorial\/'>Linux sendmail Mime Type Attachment Tutorial<\/a> is shown below.<\/p>\n<div style=\"width: 230px\" class=\"wp-caption alignnone\"><a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/Mac\/sendmail_command_line_mime_type.jpg\"><img decoding=\"async\" style=\"float:left; border: 15px solid pink;\" alt=\"Linux sendmail Mime Type Attachment Tutorial\" src=\"http:\/\/www.rjmprogramming.com.au\/Mac\/sendmail_command_line_mime_type.jpg\" title=\"Linux sendmail Mime Type Attachment Tutorial\"  \/><\/a><p class=\"wp-caption-text\">Linux sendmail Mime Type Attachment Tutorial<\/p><\/div>\n<p>Yesterday&#8217;s <a title='Linux sendmail Content Type Tutorial' href='#lctt'>Linux sendmail Content Type Tutorial<\/a> had us &#8230;<\/p>\n<ul>\n<li>following up (the Primer tutorial) sending of Content-Type: text\/plain emails via sendmail on Linux &#8230; by &#8230;<\/li>\n<li>allowing for Inline HTML Email (report) sending of Content-Type: text\/html emails via sendmail on Linux  &#8230; but &#8230;<\/li>\n<li>there are more <a target=_blank title='MIME information from Wikipedia ... thanks' href='https:\/\/en.wikipedia.org\/wiki\/MIME'>Mime Types<\/a> than just these two, but we can make email attachments out of other Mime Type data forms (often regarding &#8220;image&#8221;, &#8220;video&#8221; and &#8220;audio&#8221; media Mime Types)<\/li>\n<\/ul>\n<p> &#8230; and, of course, this opens up this command line Korn Shell scripting to so much more about what the Internet is about &#8220;sharing media files&#8221; (often created on mobile devices by the users themselves).  This ability makes users &#8220;uploaders&#8221; of content, as so many more of us are becoming every day.<\/p>\n<p>We have a favoured approach to interpretive software <font size=1>(though the same approach works well with non-interpretive coding too)<\/font> language (the types that do not need compiling) development where a project &#8230;<\/p>\n<ul>\n<li>starts as a guinea pig exercise to solve a specific set of criteria (remember &#8220;Checking on \/world.php ps -ef Reporting&#8221;?) &#8230; and we &#8230;<\/li>\n<li>genericize by &#8220;parameterizing&#8221; the &#8220;hardcoded words&#8221; in the code &#8230; for example, the color coded &#8220;hardcodings&#8221; of yesterday&#8217;s <a title='Linux sendmail Content Type Tutorial' href='#lctt'>Linux sendmail Content Type Tutorial<\/a> &#8220;First Report&#8221; email creation &#8230;<br \/>\n<code><br \/>\n       echo -e \"<font color=magenta>Content-Type: text\/html\\n<\/font>From: <font color=olive>rmetcalfe@rjmprogramming.com.au<\/font>\\nto:  <font color=green>rmetcalfe15@gmail.com<\/font>\\ncc: <font color=purple>rmetcalfe@rjmprogramming.com.au<\/font>\\nSubject: First <font color=red>Date ps-ef world.php Report<\/font> at `date`\\n<font color=blue>\\n&lt;html&gt;&lt;head&gt;&lt;style&gt; tr:nth-child(even) {background-color: #CCC !important;} tr:nth-child(odd) {background-color: #FFF !important;} &lt;\/style&gt;&lt;\/head&gt;&lt;body&gt;&lt;h1&gt;First Date ps-ef world.php Report at `date`&lt;\/h1&gt;&lt;table style='border:5px dotted olive;width:70%;height:100%;margin: 5 5 5 5;font-family:Courier-New;'&gt;&lt;tr&gt;&lt;th&gt;UID&lt;\/th&gt;&lt;th&gt;PID&lt;\/th&gt;&lt;th&gt;PPID&lt;\/th&gt;&lt;th&gt;C&lt;\/th&gt;&lt;th&gt;STIME&lt;\/th&gt;&lt;th&gt;TTY&lt;\/th&gt;&lt;th&gt;TIME&lt;\/th&gt;&lt;th&gt;CMD&lt;\/th&gt;&lt;\/tr&gt;`cat date_ps_ef_first.txt | sed '\/^\/s\/\/&lt;tr&gt;&lt;td&gt;\/g' | sed 's\/ \\{1,\\}\/&lt;\\\/td&gt;&lt;td&gt;\/g' | awk '{ t=0; while (getline \\$0) { if (t == 0) { print \\\"&lt;tr style=background-color:#e7e7e7 !important;\\\" substr(\\$0,3);  } else { print \\$0; } t=1-t; } }' | sed '\/$\/s\/\/&lt;\\\/td&gt;&lt;\\\/tr&gt;\/g'`&lt;\/table&gt;&lt;\/body&gt;&lt;\/html&gt;<\/font>\" | sendmail -t -f rmetcalfe15@gmail.com<br \/>\n<\/code><br \/>\n &#8230; becomes &#8230;<br \/>\n<code><br \/>\n       echo -e \"<font color=magenta>${mimetype}<\/font>From: <font color=olive>${emailfrom}<\/font>\\nTo:  <font color=green>${emailto}<\/font>\\nCC: <font color=purple>${emailcc}<\/font>\\n${emailbcc}Subject: First <font color=red>${subjmiddle}<\/font> at `date`\\n<font color=blue>${attachrest}<\/font>\" | sendmail -t -f ${emailto}<br \/>\n<\/code><br \/>\n &#8230; via &#8230;\n<\/li>\n<li>command line argument logic (ie. parameterization) helping derive those Korn Shell Script &#8220;$&#8221; variable value determination &#8230;<br \/>\n#!\/bin\/ksh<br \/>\n<code><br \/>\nmimetype=\"Content-Type: text\/html\\\\n\"<br \/>\nemailfrom=\"rmetcalfe@rjmprogramming.com.au\"<br \/>\nemailto=\"rmetcalfe15@gmail.com\"<br \/>\nemailcc=\"rmetcalfe@rjmprogramming.com.au\"<br \/>\nemailbcc=\"\"<br \/>\nsubjmiddle=\"Date ps-ef world.php Report\"<br \/>\nlastcur=\"\"<br \/>\nfilen=\"\"<br \/>\n<br \/>\nattachrest=\"\\\\n&lt;html&gt;&lt;head&gt;&lt;style&gt; tr:nth-child(even) {background-color: #CCC !important;} tr:nth-child(odd) {background-color: #FFF !important;} &lt;\/style&gt;&lt;\/head&gt;&lt;body&gt;&lt;h1&gt;First First ${subjmiddle} at `date`&lt;\/h1&gt;&lt;table style='border:5px dotted olive;width:70%;height:100%;margin: 5 5 5 5;font-family:Courier-New;'&gt;&lt;tr&gt;&lt;th&gt;UID&lt;\/th&gt;&lt;th&gt;PID&lt;\/th&gt;&lt;th&gt;PPID&lt;\/th&gt;&lt;th&gt;C&lt;\/th&gt;&lt;th&gt;STIME&lt;\/th&gt;&lt;th&gt;TTY&lt;\/th&gt;&lt;th&gt;TIME&lt;\/th&gt;&lt;th&gt;CMD&lt;\/th&gt;&lt;\/tr&gt;`cat date_ps_ef_first.txt | sed '\/^\/s\/\/&lt;tr&gt;&lt;td&gt;\/g' | sed 's\/ \\{1,\\}\/&lt;\\\/td&gt;&lt;td&gt;\/g' | awk '{ t=0; while (getline \\$0) { if (t == 0) { print \\\"&lt;tr style=background-color:#e7e7e7 !important;\\\" substr(\\$0,3);  } else { print \\$0; } t=1-t; } }' | sed '\/$\/s\/\/&lt;\\\/td&gt;&lt;\\\/tr&gt;\/g'`&lt;\/table&gt;&lt;\/body&gt;&lt;\/html&gt;\"<br \/>\nif [ ! -z \"$1\" ]; then<br \/>\n while [ ! -z \"$1\" ]; do<br \/>\n  if [ \"`echo \\\"${1}\\\" | tr -d '@'`\" != \"`echo \\\"${1}\\\"\" ]; then<br \/>\n   if [ \"`echo \\\"${emailto}\\\" | tr -d ' '`\" == \"`echo \\\"${emailto}\\\"\" ]; then<br \/>\n     emailto=\"${1} \"<br \/>\n   elif [ \"`echo \\\"${emailcc}\\\" | tr -d ' '`\" == \"`echo \\\"${emailcc}\\\"\" ]; then<br \/>\n     emailcc=\"${1} \"<br \/>\n   else<br \/>\n     emailbcc=\"BCC: ${1}\\\\n\"<br \/>\n   fi<br \/>\n  elif [ -f \"${1}\" ]; then<br \/>\n   if [ ! -z \"${mimetype}\" ]; then<br \/>\n    filen=\"${1}\"<br \/>\n    mimetype=\"\"<br \/>\n    shortf=\"\"<br \/>\n    basechars=\"`base64 ${filen} | tr -d \\\"\\\\n\\\"`\"<br \/>\n    i=0<br \/>\n    flast=\"`echo ${1} | tr '\/' ' ' | sed '\/\\\\\\\\\/s\/\/ \/g'`\"<br \/>\n    for filebits in ${flast}; do<br \/>\n        shortf=$filebits<br \/>\n        ((i=i+1))<br \/>\n    done<br \/>\n    subjmiddle=\"$shortf\"<br \/>\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\\\\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--\"<br \/>\n   fi<br \/>\n  fi<br \/>\n  shift<br \/>\n done<br \/>\n emailfrom=\"`echo ${emailfrom} | tr -d ' '`\"<br \/>\n emailto=\"`echo ${emailto} | tr -d ' '`\"<br \/>\n emailcc=\"`echo ${emailcc} | tr -d ' '`\"<br \/>\nfi<br \/>\n<\/code><br \/>\n &#8230; the main extra argument can point at a rjmprogramming.com.au domain web server file\n<\/ul>\n<p> &#8230; leaving &#8230;<\/p>\n<p><code><br \/>\nksh date_ps_ef.ksh &gt; \/dev\/null 2&gt; \/dev\/null &amp;<br \/>\n<\/code><\/p>\n<p> &#8230; unchanged as a rjmprogramming.com.au domain &#8220;\/world.php&#8221; ps -ef Report monitor &#8230; and the same code called &#8230;<\/p>\n<p><code><br \/>\nksh date_ps_ef.ksh .\/please_sign.mp4 &gt; \/dev\/null 2&gt; \/dev\/null &amp;<br \/>\n<\/code><\/p>\n<p> &#8230; serving to email a &#8220;First Report&#8221; email attachment that is that &#8220;please_sign.mp4&#8221; video (media) file (playable for the emailee at that email), and if anything changes about that file a &#8220;Changed Report&#8221; email attachment that is that &#8220;please_sign.mp4&#8221; video (media) file (playable for the emailee at that email) will be sent to the same emailee recipients.<\/p>\n<p>And so <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/PHP\/Geographicals\/diff.php?one=http:\/\/www.rjmprogramming.com.au\/Mac\/date_ps_ef.ksh---GETME\">the changed<\/a> <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/Mac\/date_ps_ef.ksh---GETME\">date_ps_ef.ksh<\/a> Korn Shell script has a far bigger &#8220;potential footprint&#8221; as of this incarnation.<\/p>\n<p><!--p>You can also see this play out at WordPress 4.1.1's <a target=_blank  href='\/\/www.rjmprogramming.com.au\/ITblog\/linux-sendmail-mime-type-attachment-tutorial\/'>Linux sendmail Mime Type Attachment Tutorial<\/a>.<\/p-->\n<hr>\n<p id='lctt'>Previous relevant <a target=_blank title='Linux sendmail Content Type Tutorial' href='\/\/www.rjmprogramming.com.au\/ITblog\/linux-sendmail-content-type-tutorial\/'>Linux sendmail Content Type Tutorial<\/a> is shown below.<\/p>\n<div style=\"width: 230px\" class=\"wp-caption alignnone\"><a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/Mac\/sendmail_command_line_content_type.jpg\"><img decoding=\"async\" style=\"float:left; border: 15px solid pink;\" alt=\"Linux sendmail Content Type Tutorial\" src=\"http:\/\/www.rjmprogramming.com.au\/Mac\/sendmail_command_line_content_type.jpg\" title=\"Linux sendmail Content Type Tutorial\"  \/><\/a><p class=\"wp-caption-text\">Linux sendmail Content Type Tutorial<\/p><\/div>\n<p>Yesterday&#8217;s <a title='Linux sendmail Primer Tutorial' href='#lpt'>Linux sendmail Primer Tutorial<\/a>&#8216;s command line emailing really felt &#8220;command line&#8221;.  We do not consider this an insult per se, and we tend towards &#8220;the badge of honour thinking&#8221; here.  But given reports are more trusted when impactive <font size=1>(we dare to figure)<\/font> &#8230; so &#8230; let&#8217;s add a <i>bit of<\/i> &#8220;spark&#8221; <font size=1>&#8230; luckily the CSS restrictions of HTML Inline Email <a target=_blank title='?' href='https:\/\/www.youtube.com\/watch?v=m7BgOYPNTlA'>&#8220;curbs the enthusiasm&#8221;<\/a> anyway &#8230;<\/font> to the email reporting started yesterday.<\/p>\n<p>The key to what we change is &#8230;<\/p>\n<ul>\n<li>in the <a target=_blank title='Linux sendmail' href='https:\/\/linux.die.net\/man\/8\/sendmail.sendmail'>sendmail<\/a> <a target=_blank title='Linux sendmail headers' href='https:\/\/serverfault.com\/questions\/347602\/sending-e-mail-from-sendmail-with-headers'>headers<\/a> we change <i><a target=_blank title='Content-Type Google search' href='https:\/\/www.google.com\/search?q=content-type+headers&#038;rlz=1C5CHFA_enAU832AU832&#038;oq=content-type+headers&#038;aqs=chrome..69i57j0l7.6429j0j4&#038;sourceid=chrome&#038;ie=UTF-8'>Content-Type<\/a>: text\/plain<\/i> to <i>Content-Type: text\/html<\/i> and that step alone opens the door to <a target_blank title'?' href='https:\/\/www.youtube.com\/watch?v=EK_LN3XEcnw'>&#8220;a little bit of&#8221;<\/a> style in the body section of the email &#8230; but &#8230;<\/li>\n<li>given a lot of CSS3 is not supported in HTML Inline Email styling we had to forgo &#8230;<br \/>\n<code><br \/>\n style=\"background:linear-gradient(top,pink,yellow);\"<br \/>\n<\/code><br \/>\n &#8230; for a linear-gradient background &#8230; and &#8230;<br \/>\n<code><br \/>\n&lt;head&gt;&lt;style&gt; tr:nth-child(even) {background-color: #CCC !important;} tr:nth-child(odd) {background-color: #FFF !important;} &lt;\/style&lt;\/head&gt;<br \/>\n<\/code><br \/>\n &#8230; for alternate table row colouring (as per the heads up at <a target=_blank title='Useful link' href='https:\/\/www.w3.org\/Style\/Examples\/007\/evenodd.en.html'>this link<\/a>, thanks) &#8230; for good &#8216;ol &#8230;<\/p>\n<ol>\n<li><a target=_blank title='Linux sed command information from computerhope' href='http:\/\/www.computerhope.com\/unix\/used.htm'>sed<\/a> (thanks to <a target=_blank title='Useful link, thanks' href='https:\/\/stackoverflow.com\/questions\/23106621\/replace-multiple-consecutive-white-spaces-with-one-comma-in-unix'>this useful link<\/a> for advice)<\/li>\n<li><a target=_blank title='awk' href='https:\/\/www.gnu.org\/software\/gawk\/manual\/gawk.html'>awk<\/a> (and its excellent <a target=_blank title='awk getline' href='https:\/\/www.gnu.org\/software\/gawk\/manual\/html_node\/Getline.html'><i>getline<\/i><\/a> method, and thanks to <a target=_blank title='Useful link' href='https:\/\/docs.freebsd.org\/info\/gawk\/gawk.info.Getline.html'>this useful link<\/a> for advice)<\/li>\n<\/ol>\n<p> &#8230; scripting interventions instead &#8230; so that for that &#8220;First Report&#8221; we output the report (largely) in an HTML table element as per &#8230;<br \/>\n<code><br \/>\n       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\\n&lt;html&gt;&lt;head&gt;&lt;style&gt; tr:nth-child(even) {background-color: #CCC !important;} tr:nth-child(odd) {background-color: #FFF !important;} &lt;\/style&gt;&lt;\/head&gt;&lt;body&gt;&lt;h1&gt;First Date ps-ef world.php Report at `date`&lt;\/h1&gt;&lt;table style='border:5px dotted olive;width:70%;height:100%;margin: 5 5 5 5;font-family:Courier-New;'&gt;&lt;tr&gt;&lt;th&gt;UID&lt;\/th&gt;&lt;th&gt;PID&lt;\/th&gt;&lt;th&gt;PPID&lt;\/th&gt;&lt;th&gt;C&lt;\/th&gt;&lt;th&gt;STIME&lt;\/th&gt;&lt;th&gt;TTY&lt;\/th&gt;&lt;th&gt;TIME&lt;\/th&gt;&lt;th&gt;CMD&lt;\/th&gt;&lt;\/tr&gt;`cat date_ps_ef_first.txt | sed '\/^\/s\/\/&lt;tr&gt;&lt;td&gt;\/g' | sed 's\/ \\{1,\\}\/&lt;\\\/td&gt;&lt;td&gt;\/g' | awk '{ t=0; while (getline \\$0) { if (t == 0) { print \\\"&lt;tr style=background-color:#e7e7e7 !important;\\\" substr(\\$0,3);  } else { print \\$0; } t=1-t; } }' | sed '\/$\/s\/\/&lt;\\\/td&gt;&lt;\\\/tr&gt;\/g'`&lt;\/table&gt;&lt;\/body&gt;&lt;\/html&gt;\" | sendmail -t -f rmetcalfe15@gmail.com<br \/>\n<\/code><br \/>\n &#8230; and for the &#8220;Changed Report&#8221; we output the report (largely) in an HTML textarea element as per &#8230;<br \/>\n<code><br \/>\n       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\\n&lt;html&gt;&lt;body&gt;&lt;h1&gt;Changed Date ps-ef world.php Report at `date`&lt;\/h1&gt;&lt;textarea rows=${cur} style='background-color:#e7e7e7;border:5px dotted olive;width:70%;height:100%;margin: 5 5 5 5;font-family:Courier-New;'&gt;`diff date_ps_ef_first.txt date_ps_ef_next.txt`&lt;\/textarea&gt;&lt;\/body&gt;&lt;\/html&gt;\" | sendmail -t -f rmetcalfe15@gmail.com<br \/>\n<\/code>\n<\/li>\n<\/ul>\n<p>To get to the HTML textarea element stage <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/PHP\/Geographicals\/diff.php?one=http:\/\/www.rjmprogramming.com.au\/Mac\/date_ps_ef.ksh-GETME\">we made these changes<\/a>, and then to progress onto a tabular &#8220;First Report&#8221; <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/PHP\/Geographicals\/diff.php?one=http:\/\/www.rjmprogramming.com.au\/Mac\/date_ps_ef.ksh--GETME\">we applied these changes<\/a> to the final <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/Mac\/date_ps_ef.ksh--GETME\">date_ps_ef.ksh<\/a> Korn Shell script that finished up on the rjmprogramming.com.au web server, again, started via &#8230;<\/p>\n<p><code><br \/>\nksh date_ps_ef.ksh &gt; \/dev\/null 2&gt; \/dev\/null &amp;<br \/>\n<\/code><\/p>\n<p> &#8230; to &#8220;do its th<strike>a<\/strike>ing&#8221; in the background, quietly, like.<\/p>\n<p><!--p>You can also see this play out at WordPress 4.1.1's <a target=_blank  href='\/\/www.rjmprogramming.com.au\/ITblog\/linux-sendmail-content-type-tutorial\/'>Linux sendmail Content Type Tutorial<\/a>.<\/p-->\n<hr>\n<p id='lpt'>Previous relevant <a target=_blank title='Linux sendmail Primer Tutorial' href='\/\/www.rjmprogramming.com.au\/ITblog\/linux-sendmail-primer-tutorial\/'>Linux sendmail Primer Tutorial<\/a> is shown below.<\/p>\n<div style=\"width: 230px\" class=\"wp-caption alignnone\"><a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/Mac\/sendmail_command_line.pdf\"><img decoding=\"async\" style=\"float:left; border: 15px solid pink;\" alt=\"Linux sendmail Primer Tutorial\" src=\"http:\/\/www.rjmprogramming.com.au\/Mac\/sendmail_command_line.jpg\" title=\"Linux sendmail Primer Tutorial\"  \/><\/a><p class=\"wp-caption-text\">Linux sendmail Primer Tutorial<\/p><\/div>\n<p>The <a title='Linux mailx Primer Tutorial' href='#lpt'>Linux mailx Primer Tutorial<\/a> outlined some very useful Linux (and Unix and perhaps macOS (or Mac OS X)) command line tools to email useful information to emailees.<\/p>\n<p>Today, we want to outline a <a target=_blank title='Linux sendmail' href='https:\/\/linux.die.net\/man\/8\/sendmail.sendmail'>sendmail<\/a> alternative approach for reporting purposes, perhaps, again, from the command line, and we&#8217;d like to thank <a target=_blank title='Useful link' href='https:\/\/www.linuxquestions.org\/questions\/linux-newbie-8\/sendmail-subject-and-body-4175623014\/'>this link<\/a> for great advice, here.<\/p>\n<p>Along the way, today, towards the creation of a Korn Shell Script solution to a reporting issue where we wanted to monitor a Linux system&#8217;s &#8220;<a target=_blank title='Linux ps' href='http:\/\/man7.org\/linux\/man-pages\/man1\/ps.1.html'>ps<\/a> -ef&#8221; mentions of &#8220;\/world.php&#8221; (for our rjmprogramming.com.au CentOS Linux web server operating system), and email relevant report information as a result of that monitoring environment changing, we wanted to emphasise &#8230;<\/p>\n<ul>\n<li>usefulness of Linux <a target=_blank title='Linux echo' href='http:\/\/man7.org\/linux\/man-pages\/man1\/echo.1.html'>echo<\/a>&#8216;s -e switch &#8230;<br \/>\n<blockquote cite='http:\/\/man7.org\/linux\/man-pages\/man1\/echo.1.html'><p>\n-e     enable interpretation of backslash escapes\n<\/p><\/blockquote>\n<p> &#8230; to help out the construction of sendmail headers that require line feed characters to work\n<\/li>\n<li>usefulness of <a target=_blank title='Linux backtick' href='https:\/\/unix.stackexchange.com\/questions\/27428\/what-does-backquote-backtick-mean-in-commands'>Linux\/Unix backtick<\/a> to include varieties of data into the <i>subject<\/i> and <i>body<\/i> sections of the email<\/li>\n<li>usefulness of sendmail <a target=_blank title='Linux sendmail headers' href='https:\/\/serverfault.com\/questions\/347602\/sending-e-mail-from-sendmail-with-headers'>headers<\/a> featuring heavily in the Korn Shell Email (from command line) commands <font color=blue>as per<\/font> &#8230;<br \/>\n<code><br \/>\necho -e \"<font color=blue>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`<\/font>\" | sendmail -t -f rmetcalfe15@gmail.com<br \/>\necho -e \"<font color=blue>Content-Type: text\/plain\\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\\n`diff date_ps_ef_first.txt date_ps_ef_next.txt`<\/font>\" | sendmail -t -f rmetcalfe15@gmail.com<br \/>\n<\/code>\n<\/li>\n<li>usefulness of <a target=_blank title='Linux &#038; background processing' href='https:\/\/www.google.com\/search?q=Linux+%26+background+process&#038;rlz=1C5CHFA_enAU832AU832&#038;oq=Linux+%26+background+process&#038;aqs=chrome..69i57j0l7.8476j0j7&#038;sourceid=chrome&#038;ie=UTF-8'>&#038; background processing<\/a> as per the &#8230;<br \/>\n<code><br \/>\nksh date_ps_ef.ksh &gt; \/dev\/null 2&gt; \/dev\/null &amp;<br \/>\n<\/code><br \/>\n &#8230; we ended up setting off our <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/Mac\/date_ps_ef.ksh_GETME\">date_ps_ef.ksh<\/a> Korn Shell Script reporter &#8230;<br \/>\n<code><br \/>\n#!\/bin\/ksh<br \/>\n# date_ps_ef.ksh<br \/>\n# Report on world.php<br \/>\nlastcur=\"\"<br \/>\nwhile [ 0 -lt 1 ]; do<br \/>\n   cur=\"`ps -ef | grep '\/world.php' | grep -v 'grep ' | wc -l`\"<br \/>\n   echo \"`date` $cur\"<br \/>\n   if [ \"$lastcur\" != \"$cur\" ]; then<br \/>\n     if [ -z \"$lastcur\" ]; then<br \/>\n       echo \"`ps -ef | grep '\/world.php' | grep -v 'grep '`\" &gt; date_ps_ef_first.txt<br \/>\n       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<br \/>\n     else<br \/>\n       echo \"`ps -ef | grep '\/world.php' | grep -v 'grep '`\" &gt; date_ps_ef_next.txt<br \/>\n       echo -e \"Content-Type: text\/plain\\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\\n`diff date_ps_ef_first.txt date_ps_ef_next.txt`\" | sendmail -t -f rmetcalfe15@gmail.com<br \/>\n       cat date_ps_ef_next.txt &gt; date_ps_ef_first.txt<br \/>\n     fi<br \/>\n     lastcur=\"$cur\"<br \/>\n   fi<br \/>\n   # ps -ef | grep '\/world.php' | grep -v 'grep '<br \/>\n   sleep 30<br \/>\ndone<br \/>\nexit<br \/>\n<\/code>\n<\/li>\n<\/ul>\n<p>Take a look at some of all this in action with today&#8217;s <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/Mac\/sendmail_command_line.pdf\">PDF presentation<\/a>.<\/p>\n<p><!--p>You can also see this play out at WordPress 4.1.1's <a target=_blank  href='\/\/www.rjmprogramming.com.au\/ITblog\/linux-sendmail-primer-tutorial\/'>Linux sendmail Primer Tutorial<\/a>.<\/p-->\n<hr>\n<p id='lpt'>Previous relevant <a target=_blank title='Linux mailx Primer Tutorial' href='\/\/www.rjmprogramming.com.au\/ITblog\/linux-mailx-primer-tutorial\/'>Linux mailx Primer Tutorial<\/a> is shown below.<\/p>\n<div style=\"width: 230px\" class=\"wp-caption alignnone\"><a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/Linux\/mailx\/Linux_mailx_uuencode.jpg\"><img decoding=\"async\" style=\"float:left; border: 15px solid pink;\" alt=\"Linux mailx Primer Tutorial\" src=\"http:\/\/www.rjmprogramming.com.au\/Linux\/mailx\/Linux_mailx_uuencode.jpg\" title=\"Linux mailx Primer Tutorial\"  \/><\/a><p class=\"wp-caption-text\">Linux mailx Primer Tutorial<\/p><\/div>\n<p>Think Linux and you may not associate it with email, but Linux can be excellent for many email requirements, especially using mailx and uuencode.   The use of uuencode allows you to give your email an attachment, and the mailx -s switch for the subject of the email can be used for both the purpose it was meant for, that is to establish an email subject, and with a stretch of imagination of usage, the body text, because of the quirk whereby anything after the first line of the subject will spill over into the body text of the email.   So, am sure there would be limits to the length of this body text, but you can often be brief when there is a good attachment to provide your email recipient.   Naturally, in the day and age of worry about computer viruses, your attachment will most likely be vetted by the receiving email client software for viability, so be aware of this.   Other than all that, this method of sending emails is potentially very powerful.  Notice that great way Linux and Unix can use `cat body.txt` type of syntax to embed one command within another &#8230; sometimes Linux is so simple, powerful, brilliant!   You may have noticed how short all the commands in Linux and Unix tend to be, and that is because it was intended to be short and powerful, and this is brilliant.<\/p>\n<p><font color=blue>Background reading for tutorial:<\/p>\n<ul>\n<li><a target=_blank title='mailx' href='http:\/\/linux.die.net\/man\/1\/mailx'>mailx<\/a><\/li>\n<li><a target=_blank title='uuencode' href='http:\/\/linux.die.net\/man\/1\/uuencode'>uuencode<\/a><\/li>\n<\/ul>\n<p><\/font>\n<\/p>\n<p>Here is a tutorial that introduces you to some email with attachment, subject and body text from the Linux <a target=_blank title='click picture' href='http:\/\/www.rjmprogramming.com.au\/Linux\/mailx\/Linux_mailx_uuencode.jpg'>command line<\/a>.<\/p>\n<\/p>\n<p>If this was interesting you may be interested in <a title='Click here to see topics in which you might be interested' href='#d4673' onclick='var dv=document.getElementById(\"d4673\"); dv.innerHTML = \"&lt;iframe width=670 height=600 src=\" + \"http:\/\/www.rjmprogramming.com.au\/wordpress\/?tag=Linux\" + \"&gt;&lt;\/iframe&gt;\"; dv.style.display = \"block\";'>this<\/a> too.<\/p>\n<div id='d4673' style='display: none; border-left: 2px solid green; border-top: 2px solid green;'><\/div>\n<hr>\n<p>If this was interesting you may be interested in <a title='Click here to see topics in which you might be interested' href='#d49008' onclick='var dv=document.getElementById(\"d49008\"); dv.innerHTML = \"&lt;iframe width=670 height=600 src=\" + \"https:\/\/www.rjmprogramming.com.au\/ITblog\/tag\/email\" + \"&gt;&lt;\/iframe&gt;\"; dv.style.display = \"block\";'>this<\/a> too.<\/p>\n<div id='d49008' style='display: none; border-left: 2px solid green; border-top: 2px solid green;'><\/div>\n<hr>\n<p>If this was interesting you may be interested in <a title='Click here to see topics in which you might be interested' href='#d49016' onclick='var dv=document.getElementById(\"d49016\"); dv.innerHTML = \"&lt;iframe width=670 height=600 src=\" + \"https:\/\/www.rjmprogramming.com.au\/ITblog\/tag\/command-line\" + \"&gt;&lt;\/iframe&gt;\"; dv.style.display = \"block\";'>this<\/a> too.<\/p>\n<div id='d49016' style='display: none; border-left: 2px solid green; border-top: 2px solid green;'><\/div>\n<hr>\n<p>If this was interesting you may be interested in <a title='Click here to see topics in which you might be interested' href='#d49023' onclick='var dv=document.getElementById(\"d49023\"); dv.innerHTML = \"&lt;iframe width=670 height=600 src=\" + \"https:\/\/www.rjmprogramming.com.au\/ITblog\/tag\/mimetype\" + \"&gt;&lt;\/iframe&gt;\"; dv.style.display = \"block\";'>this<\/a> too.<\/p>\n<div id='d49023' style='display: none; border-left: 2px solid green; border-top: 2px solid green;'><\/div>\n<hr>\n<p>If this was interesting you may be interested in <a title='Click here to see topics in which you might be interested' href='#d49029' onclick='var dv=document.getElementById(\"d49029\"); dv.innerHTML = \"&lt;iframe width=670 height=600 src=\" + \"https:\/\/www.rjmprogramming.com.au\/ITblog\/tag\/url\" + \"&gt;&lt;\/iframe&gt;\"; dv.style.display = \"block\";'>this<\/a> too.<\/p>\n<div id='d49029' style='display: none; border-left: 2px solid green; border-top: 2px solid green;'><\/div>\n<hr>\n<p>If this was interesting you may be interested in <a title='Click here to see topics in which you might be interested' href='#d49100' onclick='var dv=document.getElementById(\"d49100\"); dv.innerHTML = \"&lt;iframe width=670 height=600 src=\" + \"https:\/\/www.rjmprogramming.com.au\/ITblog\/tag\/nohup\" + \"&gt;&lt;\/iframe&gt;\"; dv.style.display = \"block\";'>this<\/a> too.<\/p>\n<div id='d49100' style='display: none; border-left: 2px solid green; border-top: 2px solid green;'><\/div>\n<hr>\n<p>If this was interesting you may be interested in <a title='Click here to see topics in which you might be interested' href='#d49107' onclick='var dv=document.getElementById(\"d49107\"); dv.innerHTML = \"&lt;iframe width=670 height=600 src=\" + \"https:\/\/www.rjmprogramming.com.au\/ITblog\/tag\/time\" + \"&gt;&lt;\/iframe&gt;\"; dv.style.display = \"block\";'>this<\/a> too.<\/p>\n<div id='d49107' style='display: none; border-left: 2px solid green; border-top: 2px solid green;'><\/div>\n","protected":false},"excerpt":{"rendered":"<p>Yesterday&#8217;s Linux sendmail nohup Scheduling Tutorial left us with a Linux (or unix) &#8230; nohup &#8220;&#038;&#8221; background processing recursion (perhaps) &#8230; scheduling Korn Shell script coding snippet for either &#8230; one off scheduled process execution &#8230; eg. date_ps_ef.ksh 10:43 &#8230; &hellip; <a href=\"https:\/\/www.rjmprogramming.com.au\/ITblog\/linux-sendmail-nohup-refined-scheduling-tutorial\/\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[12,37],"tags":[1885,111,113,122,126,135,234,1667,281,284,3299,380,418,1839,2718,1996,576,590,623,677,707,3303,744,760,792,1668,2732,2092,841,1886,3301,997,3300,1034,3164,1893,3310,1115,1118,2093,1279,1693,3304,1319,1339,1345,1369,1411,3302],"class_list":["post-49107","post","type-post","status-publish","format-standard","hentry","category-elearning","category-tutorials","tag-argument","tag-attachment","tag-audio","tag-awk","tag-background","tag-batch","tag-command-line","tag-content-type","tag-css","tag-curl","tag-echo","tag-email","tag-file","tag-genericization","tag-genericize","tag-header","tag-html","tag-image","tag-interpretive","tag-korn-shell","tag-linux","tag-local","tag-mamp","tag-media","tag-mime","tag-mime-type","tag-mimetype","tag-multiple","tag-nohup","tag-parameter","tag-parameterization","tag-programming","tag-ps","tag-recursion","tag-remote","tag-schedule","tag-scheduling","tag-sed","tag-sendmail","tag-single","tag-time","tag-timezone","tag-token","tag-tutorial","tag-unix","tag-url","tag-video","tag-web-server","tag-wildcard"],"_links":{"self":[{"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/posts\/49107"}],"collection":[{"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/comments?post=49107"}],"version-history":[{"count":7,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/posts\/49107\/revisions"}],"predecessor-version":[{"id":49123,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/posts\/49107\/revisions\/49123"}],"wp:attachment":[{"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/media?parent=49107"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/categories?post=49107"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/tags?post=49107"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}