それマグで!

知識はカップより、マグでゆっくり頂きます。 takuya_1stのブログ

習慣に早くから配慮した者は、 おそらく人生の実りも大きい。
") }) jQuery.noConflict()(document).ready(function(){ /**ページャーが気に入らないので修正**/ //やるべきこと // pre・next のいれかえ jQuery('span.pager-next').insertAfter('span.pager-prev') // pre/next に矢印を入れる jQuery('a[rel=next]').text(jQuery('a[rel=next]').text()+"> ") jQuery('a[rel=prev]').text("< "+jQuery('a[rel=prev]').text()) // pre/next をヘッダにもってくる //jQuery(".date.first").css("display","inline-block") jQuery('div.permalink.pager').clone().insertAfter(".date.first") jQuery("header .pager a").css("padding","0px 15px"); //pre/next をAjaxで取得してタイトルを取る。 //取得したタイトルをpre/next のタイトルに jQuery('span.pager-next,span.pager-prev').css("display","inline-block") jQuery('span.pager-next,span.pager-prev').css("width","250px"); jQuery('span.pager-next,span.pager-prev').css("overflow", "hidden"); jQuery('span.pager-next,span.pager-prev').css("white-space", "nowrap"); jQuery('span.pager-next,span.pager-prev').css("text-overflow", "ellipsis"); jQuery("a[rel=next],a[rel=prev]").each(function(idx,e){ var anchor = e jQuery.get(anchor.href,null,function(html){ jQuery(anchor).text() var title = jQuery("
").html(html).find(".entry-title").text().trim() jQuery(anchor).attr("title", title); text = jQuery(anchor).text() text = text.slice(0,10); text = text.replace(/の記事/, "の記事 ["+title+"] "); jQuery(anchor).text(text) }) }); }); })

sendmail でコマンドからメールを送信する。

メール通知のテストに使う。

postfix や exim4 のメールサーバーの設定をしていて、テスト・メールを送信したいときに、手作業でsendmail コマンドを送るのは、ちょっと面倒なのと、どのメールが未到達で、どのメールが到達したか区別するのが大変なのでスクリプト書きました。

サンプルスクリプト。

サンプルスクリプトでは、連番を入れて、どのメールか識別できるようにしてて、日付と時刻をいれてそちらでも識別できるようにしておいた。

send_mail.sample.sh

#!/usr/bin/env bash


function counter() {
  if [[ !  -f /tmp/count ]] ;  then
    touch /tmp/count
    echo 1 > /tmp/count
  fi
  num=$(tail -n 1 /tmp/count)
  echo $(( num+1 )) > /tmp/count
  echo $num
}



ifs=$IFS
IFS=''
text="\
To:[email protected]
Subject: Hello, From $(hostname)

Hi, can you see me ?

num:$(counter)


---
takuya
 $(date --rfc-3339=seconds)
"


echo  $text
echo -e $text | sendmail -i -t

2019-12-13

タイプミスを修正