nul-point

完全に自分用の備忘録です。

apacheでVirtualHost一覧を出力する

出力の結果は同じように見える 何か違いがあるとは思うけどまだ理解してない そのうち調べよう・・・と思ったら純粋にただのsynonym(同意語)だった・・・・

[~]/usr/local/apache2/bin/httpd -t -D DUMP_VHOSTS
VirtualHost configuration:
192.168.2.100:80      example.com (/usr/local/apache2/conf/httpd.conf:32)
Syntax OK

[~]/usr/local/apache2/bin/httpd -S
VirtualHost configuration:
192.168.2.100:80      example.com (/usr/local/apache2/conf/httpd.conf:32)
Syntax OK

[~]/usr/local/apache2/bin/httpd -h
Usage: /usr/local/apache2/bin/httpd [-D name] [-d directory] [-f file]
                                    [-C "directive"] [-c "directive"]
                                    [-k start|restart|graceful|graceful-stop|stop]
                                    [-v] [-V] [-h] [-l] [-L] [-t] [-T] [-S]
Options:
  -D name            : define a name for use in <IfDefine name> directives
  -d directory       : specify an alternate initial ServerRoot
  -f file            : specify an alternate ServerConfigFile
  -C "directive"     : process directive before reading config files
  -c "directive"     : process directive after reading config files
  -e level           : show startup errors of level (see LogLevel)
  -E file            : log startup errors to file
  -v                 : show version number
  -V                 : show compile settings
  -h                 : list available command line options (this page)
  -l                 : list compiled in modules
  -L                 : list available configuration directives
  -t -D DUMP_VHOSTS  : show parsed settings (currently only vhost settings)
  -S                 : a synonym for -t -D DUMP_VHOSTS
  -t -D DUMP_MODULES : show all loaded modules 
  -M                 : a synonym for -t -D DUMP_MODULES
  -t                 : run syntax check for config files
  -T                 : start without DocumentRoot(s) check

CentOS6.5にWeb::ScraperをCPANで入れる

流れ

  • cpanインストール
  • Module::Buildインストール
  • cpan経由でWeb::Scraperインストール
[~]# yum install perl-CPAN
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
[省略]
Installed:
  perl-CPAN.x86_64 0:1.9402-136.el6                                                                                                                                               

Dependency Installed:
  db4-cxx.x86_64 0:4.7.25-18.el6_4               db4-devel.x86_64 0:4.7.25-18.el6_4               gdbm-devel.x86_64 0:1.8.0-36.el6         perl-Digest-SHA.x86_64 1:5.47-136.el6 
  perl-ExtUtils-MakeMaker.x86_64 0:6.55-136.el6  perl-ExtUtils-ParseXS.x86_64 1:2.2003.0-136.el6  perl-Test-Harness.x86_64 0:3.17-136.el6  perl-devel.x86_64 4:5.10.1-136.el6

[~]# yum install perl-Module-Build
Loaded plugins: fastestmirror
No such command: isntall. Please use /usr/bin/yum --help
[省略]
Installed:
  perl-Module-Build.x86_64 1:0.3500-136.el6                                                                                                                                       

Dependency Installed:
  perl-Archive-Tar.x86_64 0:1.58-136.el6    perl-ExtUtils-CBuilder.x86_64 1:0.27-136.el6    perl-IO-Zlib.x86_64 1:1.09-136.el6    perl-Package-Constants.x86_64 1:0.02-136.el6

[~]# cpan


CPAN is the world-wide archive of perl resources. It consists of about
300 sites that all replicate the same contents around the globe. Many
countries have at least one CPAN site already. The resources found on
CPAN are easily accessible with the CPAN.pm module. If you want to use
CPAN.pm, lots of things have to be configured. Fortunately, most of
them can be determined automatically. If you prefer the automatic
configuration, answer 'yes' below.

If you prefer to enter a dialog instead, you can answer 'no' to this
question and I'll let you configure in small steps one thing after the
other. (Note: you can revisit this dialog anytime later by typing 'o
conf init' at the cpan prompt.)
Would you like me to configure as much as possible automatically? [yes] 
※Enterキー叩いて流れるログを眺める
[省略]
cpan shell -- CPAN exploration and modules installation (v1.9402)
Enter 'h' for help.

cpan[3]> install Web::Scraper
Running install for module 'Web::Scraper'
CPAN: Data::Dumper loaded ok (v2.124)
'YAML' not installed, falling back to Data::Dumper and Storable to read prefs '/root/.cpan/prefs'
Running make for M/MI/MIYAGAWA/Web-Scraper-0.37.tar.gz

※このさきいろんな依存モジュールもインストールする必要があるので全部イエスで
 ちなみに1回めはインストールはこけた

Failed during this command:
 INGY/Spiffy-0.46.tar.gz                      : make_test NO
 OVID/Text-Diff-1.41.tar.gz                   : make_test NO
 INGY/Test-Base-0.88.tar.gz                   : make_test NO
 BINGOS/ExtUtils-MakeMaker-6.98.tar.gz        : make_test NO
 INGY/Test-YAML-1.05.tar.gz                   : make_test NO one dependency not OK (Test::Base)
 INGY/YAML-1.12.tar.gz                        : make_test NO
 CORION/HTML-Selector-XPath-0.18.tar.gz       : make_test NO
 MIYAGAWA/Web-Scraper-0.37.tar.gz             : make_test NO

※再チャレンジ
cpan[4]> install Web::Scraper
Running install for module 'Web::Scraper'
Running make for M/MI/MIYAGAWA/Web-Scraper-0.37.tar.gz
  Has already been unwrapped into directory /root/.cpan/build/Web-Scraper-0.37-TtCFJn

[省略]

Installing /usr/local/share/perl5/Web/Scraper.pm
Installing /usr/local/share/perl5/Web/Scraper/Filter.pm
Installing /usr/local/share/perl5/Web/Scraper/LibXML.pm
Installing /usr/local/share/man/man3/Web::Scraper::LibXML.3pm
Installing /usr/local/share/man/man3/Web::Scraper::Filter.3pm
Installing /usr/local/share/man/man3/Web::Scraper.3pm
Installing /usr/local/bin/scraper
Appending installation info to /usr/lib64/perl5/perllocal.pod
  MIYAGAWA/Web-Scraper-0.37.tar.gz
  /usr/bin/make install  -- OK
※無事入った模様
cpan[5]> m Web::Scraper
Module id = Web::Scraper
    CPAN_USERID  MIYAGAWA (Tatsuhiko Miyagawa <miyagawa@bulknews.net>)
    CPAN_VERSION 0.37
    CPAN_FILE    M/MI/MIYAGAWA/Web-Scraper-0.37.tar.gz
    UPLOAD_DATE  2012-10-19
    MANPAGE      Web::Scraper - Web Scraping Toolkit using HTML and CSS Selectors or XPath expressions
    INST_FILE    /usr/local/share/perl5/Web/Scraper.pm
    INST_VERSION 0.37

※一回めこけた理由についてはログをちゃんと追わないとわからないっぽい

findで特定の日付でファイルを絞る

-newerXYで絞る

# find . -type f -newermt 2013-5-16 -ls
133887   68 -rwxr-xr-x   1 root     root        68616 May 16  2013 ./gzip
140242   52 -rwxr-xr-x   1 root     root        52656 May 16  2013 ./touch
133871   16 -rwxr-xr-x   1 root     root        12304 Sep 17 16:38 ./tracepath6
133894   12 -rwxr-xr-x   1 root     root        11912 Jun 14  2013 ./cgdelete
132237   32 -rwxr-xr-x   1 root     root        28784 May 16  2013 ./nice
134453   16 -rwxr-xr-x   1 root     root        13696 Jun 14  2013 ./lssubsys
133899   64 -rwxr-xr-x   1 root     root        65032 May 16  2013 ./stty
133874   20 -rwxr-xr-x   1 root     root        20176 Jun 14  2013 ./cgsnapshot
132234   60 -rwxr-xr-x   1 root     root        57464 May 16  2013 ./chown
134454   28 -rwxr-xr-x   1 root     root        28176 May 16  2013 ./echo
133893   28 -rwxr-xr-x   1 root     root        25120 May 16  2013 ./true
141296   28 -rwxr-xr-x   1 root     root        26256 May 16  2013 ./link
~

-newerで絞る

絞りたい日時でファイルを作成

touch -t 1401030000 hoge
touch -t 1401050000 fuga
# find . -newer hoge -a ! -newer fuga -ls
153977    0 -rw-r--r--   1 root     root            0 Jan  5 00:00 ./fuga
153805    0 -rw-r--r--   1 root     root            0 Jan  5 00:00 ./file05
153804    0 -rw-r--r--   1 root     root            0 Jan  4 00:00 ./file04