Asynchronous Email Using PHP & Bash

Problem #1: An apps need to send email to one receiver a time after quote page saved. Apps & Send mail api made with PHP. [ solved ].

Problem #2: Apps need to broadcast email at least 20 receiver a time. Quote saving process now blocking ( > 1 minutes ) until all email has sent. Solve the problem.

Solution:
A simple way. Just using bash and curl. Put into crontab with your desired time queue.

#!/bin/bash
#set -x

api_url='http://secret-domain.com/api/email_quote/'
pid_directory='/home/secret-agent/broadcast_queue/'

send_mail(){

  pid="$1.process"
  pid_path=$pid_directory"$pid"

  mv $pid_directory"$1" $pid_path

  curl $api_url"$1" > $pid_path
  if grep -Fxq "success" $pid_path
  then
    rm $pid_path
    echo $(date +"%Y%m%d %H:%M")" - $1 created" 2>&1 >> $pid_directory"mail.log"
  else
    echo $(date +"%Y%m%d %H:%M")" - $1 error" 2>&1 >> $pid_directory"mail.log"
  fi

}

# check if there is available quote to process 
quote_list=$(ls -1 -I "*.process" -I "*.log" $pid_directory)
if [ -z "$quote_list" ]
then
  echo "nothing to process"
  exit 0
fi

for filename in $quote_list; do
  # made async call by put it into background
  send_mail $(basename $filename) &
done

Harga Development Software

Client : Mas, kok mahal banget softwarenya?!. Masa seharga mobil !
Saya : Ya bapak nge-grab aja.

Client : Mas, mahal banget trainingnya. Seharga motor nih !
Saya : Ya bapak ngojek aja.

Silahkan digunaken sebagai template kalau ketemu client dengan tipe sejenis. Boleh disebarluaskan dengan lisensi WTFPL.

TSB’s April IT crash leads to £107m loss

https://www.bankingtech.com/2018/07/tsbs-april-it-crash-leads-to-107m-loss/

The IT crash in April has hit TSB hard in its latest financial results with a loss before tax of £107.4 million.

In its results for the six months to 30 June 2018, the bank says its mobile, online, telephone and branch services have recovered and improved, following the drama, which resulted in a big public backlash.

Paul Pester, TSB CEO, released a statement with the expected apology and stressing the intention of fixing things, just like the bank said soon after the crash happened.

As a result of all these issues, TSB is making efforts to minimise service disruption, which includes the recruitment of 1,800 people and reorganisation of 700 staff to customer-facing roles, as well as addressing customer complaints.

TSB has recognised additional post-migration costs, including customer compensation, of £176.4 million. For comparison, the firm reported a profit of £108.3 million in H1 2017.

The bank reports total customer lending of £31 billion, with customer deposits at £29.6 billion and its common equity tier 1 capital ratio remained strong at 19.2%.

The customer balance is roughly 26,000 customers lost, but 20,000 new customers gained.

The delivery of the migration programme resulted in income from Lloyds of £318 million, which was offset by a charge of £318 million for migration related costs.

If you like drama, IBM had some words to say about why the crash happened.

Mengasah Otak untuk Memecahkan Masalah

Rubrik Bahasa

Sapardi Djoko Damono*, Majalah Tempo, 23 Feb 2015

Ilustrasi: Medical Daily

Konon, kalau ingin cerdas, kita harus sering-sering mengasah otak. Otak dianggap atau disamakan dengan pisau, yang harus sering diasah agar meningkat ketajamannya. Kalau kita menafsirkannya secara harfiah, ungkapan itu sungguh mengerikan. Otak diambil dari kepala, diadu dengan batu pengasah supaya tajam. Di samping itu, otak kita sama sekali berbeda wujudnya dengan pisau, yang memang kita ciptakan sedemikian rupa agar bisa ditajamkan. Bahasa adalah alat komunikasi utama dalam kehidupan, tidak hanya manusia, tapi juga semua makhluk hidup. Kita manusia, oleh karena itu, hanya mengetahui bagaimana cara mengutak-atik alat komunikasi kita ini agar, kira-kira, bisa lebih mampu menyampaikan maksud yang diinginkan. Salah satu hasil utak-atik yang ampuh, kalau tidak boleh dikatakan dahsyat, adalah kiasan.

Lihat pos aslinya 441 kata lagi