tinydnsでSPFレコードを設定する

tinydnsは、小さく、信頼性の高いDNS権威サーバ/キャッシュサーバですは、開発がとまっているようで使っている人は少ないと思いますが、古いサーバーでこのDNSサーバーを利用している環境があって、そのサーバーに送信ドメイン認証のひと ...
除外リストにある文字を含む行を削除する方法「シェルスクリプト」

アカウント・ディレクトリ等の一覧のをファイルが有り、そのファイル内で特定の文字を含む行を削除したい場合は、「sed」コマンドを利用すればできます。
その削除したい文字列を除外リストのようなファイルにある場合は、while re ...
シェルスクリプトの if文で複数の条件を指定する

シェルスクリプトでif文でAND条件やOR条件を複数指定したい場合ですが、以下のようにすればOKです
if文でAND条件の場合AND条件では「条件1 -a 条件2」と条件を「-a」を付与して続け ...
topコマンドでコア単位でCPU使用率を確認する

topコマンドではCPUの使用率が表示されますが、デフォルトでは複数のCPUコアを1つにまとめて表示されます。
これをCPU使用率をコア別に表示するには、topコマンドを叩いてから「1」のキーを押します
起動時にロードするカーネルを変更・指定する

yum updateでカーネルのバージョンが上がった場合、サーバーの再起動とかして、OSが起動する場合は、その時に最新のカーネルで起動します。yum update ...
historyコマンドの履歴を削除する方法

コマンドの履歴を表示する「history」コマンドがあります。コマンドで引数にパスワードを付きのコマンドを利用したり、間違った内容をペーストしたりして「history」の履歴したい場合あるかと思います。個 ...
ChromeでCentOS 5系のSSLサイトがアクセスできなくなった

ChromeでCentOS 5.5で稼働しているSSLサイトにアクセスすると、「プライバシエラー」と表示されサイトが表示されません
「NET::ERR_SSL_O ...
CUI環境でグローバルIPを確認する方法

GUI環境でグローバルIPを確認するには、ブラウザでグローバルIPを確認できるサイト「CMAN:IPアドレス情報」・「確認くん」にアクセスすれば確認できます
CUI環境でブラウザ ...
dateコマンドの結果をUnixTime(エポック秒)で表示

dateコマンドでUnixTimeに表示するオプションは「+%s」を使用するとUnixTimeで表示できます
$ date +%s1583900131UnixTimeを日付に表示するlsコマンドで、UNIXTIME(エポック秒)を取得する

ファイルのタイムスタンプを比較してから〇〇分経過していない場合は、Aの処理するようなシェルスクリプトを作る必要になり、シェルスクリプトで時間計算する場合はUnixTimeに変換する必要があるので、lsコマンドでタイムスタンプをUnix ...
while readで最終行が処理されない【シェルスクリプト】

Windowsで生成したファイルをシェルスクリプトでwhile readを利用して、catコマンドでファイルを出力して、内 ...
シェルスクリプトで「Enter」を押さないと処理を進めないようにする

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

Linuxで物理メモリを使い切るとswap領域を使用します。今のメモリ状況は「free」コマンドで確認できます。
下記では、「-m」のオプションでメモリの量をMB単位で表示しています。
Windowsで作成したシェルスクリプトで実行すると、「command not found」エラー

シェルスクリプトを作るときはAtom等のエディタで作ってSCPでアップしていました。macOSからWindowsに変更して ...
関数の呼び出し順で「command not found」のエラー

関数を使ったシェルスクリプトで関数の呼び出す場所は、定義した関数より前に書くと「command not found」や「Main: コマンドが見つかり ...