スキップしてメイン コンテンツに移動

投稿

2016の投稿を表示しています

連番ファイルを100個作る

連番ファイルは # touch file{1..100} ってすれば、file1からfile100という空っぽのファイルを作ってくれる。 # touch file{001..100} ってすれば、file001, file002, ...みたいにゼロ埋めしてくれて桁が揃う。 10KBのファイルを100個作りたかったら # dd if=/dev/zero of=file bs=1024 count=10 ってやって10KBのファイルを作ってから # for i in `seq -w 1 100`; do cp file file${i}; done ってやれば、file001, file002, ...って作れる。

wgetでサイトをバックアップ

これでいけるかと。 wget -e robots=off\ --output-file=./wget.log\ --no-cache\ --html-extension\ --convert-links\ --page-requisites\ --restrict-file-names=nocontrol,windows\ --domains=www.example.com\ --no-parent\ --mirror\ --wait=1\ --waitretry=1\ --timeout=5\ http://www.example.com/ WordPressサイトは、feedを取得しないようにするとこうなる。 wget -e robots=off\ --output-file=./wget.log\ --no-cache\ --html-extension\ --convert-links\ --page-requisites\ --restrict-file-names=nocontrol,windows\ --domains=www.example.com\ --no-parent\ --mirror\ --wait=1\ --waitretry=1\ --timeout=5\ --exclude-directories=/feed\ http://www.example.com/ あと、コメントのフィードリンクがページ中にあると、せっかくダウンロードしたページがフォルダに変わってしまって feed っていうファイルだけになってしまうので、先にこちらを参考にlinkを消してください。 ■[WordPress] コメントの RSS フィードリンクを削除する http://jz5.jp/2013/11/23/remove-wordpress-comment-rss/ remove_action('wp_head', 'feed_links_extra', 3); だけ追加してもOKだった。 その他、wget のオプションはここがすごくわかりやすかった。 ■ダウンロードコマンドwg...

apachectl fullstatus の Request 列の改行を制御する

[root@websv ~] # which apachectl /usr/sbin/apachectl [root@websv ~] # less /usr/sbin/apachectl ... # |||||||||||||||||||| START CONFIGURATION SECTION |||||||||||||||||||| # -------------------- -------------------- # # the path to your httpd binary, including options if necessary HTTPD='/usr/sbin/httpd' # # # a command that outputs a formatted text version of the HTML at the # url given on the command line. Designed for lynx, however other # programs may work. if [ -x "/usr/bin/links" ]; then LYNX="/usr/bin/links -dump" else LYNX=none fi # # the URL to your server's mod_status status page. If you do not # have one, then status and fullstatus will not work. STATUSURL="http://websv:80/server-status" ... [root@websv ~] # man links ... -dump-width (alias for document.dump.width) Width of the dump output. ... [root@websv ~] # /usr/bin/links -dump http://websv:80/server-status/ ... Srv PID Acc M CPU SS Re...

MySQL サーバーシステム変数 のデフォルトを確認する方法

サーバーのコンパイル時のデフォルトおよび読み取られるオプションファイルに基づいて、サーバーが使用する値を表示するには、次のコマンドを使用します。 mysqld --verbose --help すべてのオプションファイルの設定を無視し、サーバーのコンパイル時のデフォルトに基づいてサーバーが使用する値を表示するには、次のコマンドを使用します。 mysqld --no-defaults --verbose --help 実行中のサーバーによって使用される現在の値を表示するには、SHOW VARIABLES ステートメントを使用します。 引用:MySQL 5.6 リファレンスマニュアル 5.1.4 サーバーシステム変数 https://dev.mysql.com/doc/refman/5.6/ja/server-system-variables.html

yum の使い方

インストール yum install hogehoge アップデートの確認 yum check-update アップデート yum update hogehoge 削除 yum remove hogehoge インストール済みパッケージ一覧 yum list install 旧バージョンも含めてパッケージ一覧を表示する yum --showduplicates list hogehoge

メールアドレスのローカルパート8文字制限

ある人と名刺交換したとき、 相手 「おれさんって、shi じゃなくて si なんですね」 って言われた。 おれ 「そうなんですよ、8文字制限があったころの古い人間でして」 相手 「いや、私も chi じゃなくて ti なんでね・・・同類ですよ」 二人 「はっはっはっ」 って会話になった。 最近、ここに書くネタがない・・・

Corosync と Pacemaker でクラスタ化されたサーバのメンテナス

普通に監視対象サービスを停止しちゃうとフェイルオーバーするので、 それを回避する方法。 1.メンテナンスモードを有効にする。 crm configure property maintenance-mode=true 2.必要な作業を行う。 サービス停止してもフェイルオーバーしないので、設定ファイルいじったりできる。 停止したサービスは、起動してから次の手順へ。 停止は crm resource stop リソース名 開始は crm resource start リソース名 再起動は crm resource restart リソース名 ※その他、crmコマンドの詳細は、こちらのサイトがわかりやすかったです。 CRM CLI (command line interface) tool 3.メンテナンスモードを終了する。 crm configure property maintenance-mode=false 以上!

systemctl と chkconfig と service の使い方まとめ

サービス一覧 # chkconfig --list # systemctl list-unit-files -t service 自動起動設定 # chkconfig hoge on # systemctl enable hoge.service 自動起動解除 # chkconfig hoge off # systemctl disable hoge.service サービス起動 # service hoge start # systemctl start hoge.service サービス状態確認 # service hoge status # systemctl status hoge.service サービス停止 # service hoge stop # systemctl stop hoge.service

CentOS 7 ClamAV インストール

yum install epel-release yum install clamav clamav-update vi /etc/freshclam.conf ------------------------------------------------------------ #Example ------------------------------------------------------------ /etc/sysconfig/freshclam ------------------------------------------------------------ #FRESHCLAM_DELAY=disabled-warn # REMOVE ME ------------------------------------------------------------ vi /etc/cron.weekly/clamscan ------------------------------------------------------------ #!/bin/bash PATH=/usr/bin:/bin # clamd update yum -y update clamav clamav-update > /dev/null 2>&1 # excludeopt setup excludelist=/usr/local/etc/clamscan.exclude if [ -s $excludelist ]; then for i in `cat $excludelist` do if [ $(echo "$i"|grep \/$) ]; then i=`echo $i|sed -e 's/^\([^ ]*\)\/$/\1/p' -e d` excludeopt="${excludeopt} --exclude-dir=$i" else excludeopt="${excludeopt} --exclude=$i" fi ...