シェルスクリプトで変数が空文字であるか調べる

シェルスクリプトで変数に値が入っているか調べるには、testコマンドやif分で変数の値を比較して調べることができます。
testコマンドで変数が空文字であるか調べるtestコマンド ...
locateコマンドのインストール

検証サーバーを最小構成で構成したので、locateコマンドがインストールされずいないので、mlocateパッケージをインストールすればインストールされます
$ sudo yum install mlocateインストール直 ...
yumエラー:「Not using downloaded mariadb/repomd.xml because it is older than what we have:」

検証用のサーバーで、yumでレポジト ...
IPアドレスをsortコマンドで並び替える

IPアドレスを記載されている下記のようなテキストファイルがある場合に、sortコマンドを利用してIPアドレス順に並べるには、「-V –version-sor ...
ファイルの所有者を監視するスクリプト

PHPでファイルの書込み処理をするプログラムがあって、そのファイルの所有権が「apaceh」以外だとパーミッションエラーとなり書込みが失敗するので、ファイルの所有者がApacheか ...
ownCloudの手動バージョンアップ

ownCloudのクライアントで新しいバージョンにアップグレードしたので、久しぶりにWEBにownCloudにアクセスしてみると下記のようにサーバー側も新しいバージョンにアップデートできる ...
SSH接続がタイムアウトになる場合のサーバー側の設定

KeepAliveパケットをSSHサーバー側に送信しないSSHクライアントを使用している場合、数分通信を行なっていない場合はSSHサーバーとの通信が切れてタイムアウトになります。
while readで最終行が処理されない【シェルスクリプト】

Windowsで生成したファイルをシェルスクリプトでwhile readを利用して、catコマンドでファイルを出力して、内 ...
cut, awkコマンドで区切り文字を指定して取り出す

cutコマンド、awkコマンドを利用して、任意の区切り文字で区切られた文字を取り出す方法を紹介します。
以下のファイルでは、「:」で区切りを入れてIPアドレス:ポート番号を記載されています ...
シェルスクリプトを利用して、iptablesに特定のIPを拒否するスクリプト

iptablesのF/Wで特定のIPアドレスを拒否(DROP)したい場合に、その都度コマンドを入力するのが面倒なので、シェルスクリプトで引数に拒否したいIPアドレ ...
SMTP Authを何度も試みててくるIPアドレスをブロックする【postfix】

メールサーバーを運用していると、海外からのSPAM業者がSTMPサーバーにアクセスしてきます。いちようメールサーバーはSMTP認証をし ...
IPアドレスを指定して受信拒否 【postfix】

Postfixでメールサーバーを運用していると迷惑メール・SPAMメール等で対策で特定のIPアドレスからの接続を拒否したいケースがあります。
その場合はPostfixの設定フ ...
SPAMデータベースを利用して迷惑メール対策【postfix】

postfixを利用してメールサーバーを構築してるサーバーがあります。このメールサーバーですが迷惑メール業者からのアクセスが多いので何かしらの対策が必要でしたので、 ...
シェルスクリプトで「Enter」を押さないと処理を進めないようにする

シェルスクリプトで処理を進めていて、変数とか処理に問題なければ処理を進めたいケースがあります。その場合に「エンター(Enter)キー」を押すと処理を進める場合は「read Wait」と ...
postfixで送信・受信・送受信を転送する

送信したメール・受信したメール・送受信したメールを転送(アーカイブ)する仕組みとしてpostfixでは、「always_bcc」、「sender_bcc_maps」、「r ...