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

投稿

find でパーミッションとオーナー・グループを条件に検索して パーミッションを変更する

オーナー hoge に 644 与えてある /var/www/html 配下のファイルのパーミッションを 664 に変更する。 # find /var/www/html -perm 644 -type f -user hoge -print0 | xargs -0 chmod 664 グループ hoge に 644 与えてある /var/www/html 配下のファイルのパーミッションを 664 に変更する。 # find /var/www/html -perm 644 -type f -group hoge -print0 | xargs -0 chmod 664 オーナー hoge に 755 与えてある /var/www/html 配下のディレクトリのパーミッションを 775 に変更する。 # find /var/www/html -perm 755 -type f -user hoge -print0 | xargs -0 chmod 775 グループ hoge に 755 与えてある /var/www/html 配下のディレクトリのパーミッションを 775 に変更する。 # find /var/www/html -perm 755 -type f -group hoge -print0 | xargs -0 chmod 775

DNS の TTL と minimum値

TTL:存在することをキャッシュしておく時間。 minimum:存在しないことをキャッシュしておく時間。 なので、example.com ドメインに新しく hoge.example.com というホストを追加する場合、事前に TTLを短くしておいても minimum値が長かったら、minimum値の間は名前解決できない。

連番ファイルを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...