連番作成コマンド

$ seq -f %03g.txt 10
001.txt
002.txt
003.txt
004.txt
005.txt
006.txt
007.txt
008.txt
009.txt
010.txt
$
$
$ ll {001..010}.txt
-rw-r--r-- 1 hoge users 0  23 01:39 2013 001.txt
-rw-r--r-- 1 hoge users 0  23 01:39 2013 002.txt
-rw-r--r-- 1 hoge users 0  23 01:39 2013 003.txt
-rw-r--r-- 1 hoge users 0  23 01:39 2013 004.txt
-rw-r--r-- 1 hoge users 0  23 01:39 2013 005.txt
-rw-r--r-- 1 hoge users 0  23 01:39 2013 006.txt
-rw-r--r-- 1 hoge users 0  23 01:39 2013 007.txt
-rw-r--r-- 1 hoge users 0  23 01:39 2013 008.txt
-rw-r--r-- 1 hoge users 0  23 01:39 2013 009.txt
-rw-r--r-- 1 hoge users 0  23 01:39 2013 010.txt
$

Jenkinsインストール

https://wiki.jenkins-ci.org/display/JENKINS/Installing+Jenkins+on+RedHat+distributions
のまんま

[root@vm02 ~]# wget -O /etc/yum.repos.d/jenkins.repo http://pkg.jenkins-ci.org/redhat/jenkins.repo
--2013-01-15 08:34:03--  http://pkg.jenkins-ci.org/redhat/jenkins.repo
pkg.jenkins-ci.org をDNSに問いあわせています... 63.246.20.93
pkg.jenkins-ci.org|63.246.20.93|:80 に接続しています... 接続しました。
HTTP による接続要求を送信しました、応答を待っています... 200 OK
長さ: 75 [text/plain]
`/etc/yum.repos.d/jenkins.repo' に保存中

100%[=====================================================================================================>] 75          --.-K/s 時間 0s

2013-01-15 08:34:04 (4.82 MB/s) - `/etc/yum.repos.d/jenkins.repo' へ保存完了 [75/75]

[root@vm02 ~]#
[root@vm02 ~]# rpm --import http://pkg.jenkins-ci.org/redhat/jenkins-ci.org.key
[root@vm02 ~]#
[root@vm02 ~]# yum install jenkins


Dependencies Resolved

===============================================================================================================================================
 Package                          Arch                            Version                               Repository                        Size
===============================================================================================================================================
Installing:
 jenkins                          noarch                          1.499-1.1                             jenkins                           46 M

Transaction Summary
===============================================================================================================================================
Install       1 Package(s)


[root@vm02 ~]#
[root@vm02 ~]# /etc/init.d/jenkins start
Starting Jenkins bash: /usr/bin/java: そのようなファイルやディレクトリはありません
                                                           [失敗]
[root@vm02 ~]#
[root@vm02 ~]#  yum install java-1.6.0-openjdk


Dependencies Resolved

===============================================================================================================================================
 Package                              Arch                     Version                                         Repository                 Size
===============================================================================================================================================
Installing:
 java-1.6.0-openjdk                   x86_64                   1:1.6.0.0-1.50.1.11.5.el6_3                     updates                    25 M
Installing for dependencies:
 giflib                               x86_64                   4.1.6-3.1.el6                                   base                       37 k
 jline                                noarch                   0.9.94-0.8.el6                                  base                       86 k
 jpackage-utils                       noarch                   1.7.5-3.12.el6                                  base                       59 k
 rhino                                noarch                   1.7-0.7.r2.2.el6                                base                      778 k
 tzdata-java                          noarch                   2012i-2.el6                                     updates                   155 k

Transaction Summary
===============================================================================================================================================
Install       6 Package(s)


[root@vm02 ~]# which java
/usr/bin/java
[root@vm02 ~]# /etc/init.d/jenkins start
Starting Jenkins                                           [  OK  ]

capistrano インストール

[root@vm02 ~]# which gem
/usr/local/bin/gem
[root@vm02 ~]#
[root@vm02 ~]# gem install capistrano
Fetching: highline-1.6.15.gem (100%)
Fetching: net-ssh-2.6.3.gem (100%)
Fetching: net-sftp-2.0.5.gem (100%)\]
Fetching: net-scp-1.0.4.gem (100%)
Fetching: net-ssh-gateway-1.1.0.gem (100%)
Fetching: capistrano-2.14.1.gem (100%)
Successfully installed highline-1.6.15
Successfully installed net-ssh-2.6.3
Successfully installed net-sftp-2.0.5
Successfully installed net-scp-1.0.4
Successfully installed net-ssh-gateway-1.1.0
Successfully installed capistrano-2.14.1
6 gems installed
Installing ri documentation for highline-1.6.15...

Installing ri documentation for net-ssh-2.6.3...
Installing ri documentation for net-sftp-2.0.5...
Installing ri documentation for net-scp-1.0.4...
Installing ri documentation for net-ssh-gateway-1.1.0...
Installing ri documentation for capistrano-2.14.1...
Installing RDoc documentation for highline-1.6.15...
Installing RDoc documentation for net-ssh-2.6.3...
Installing RDoc documentation for net-sftp-2.0.5...
Installing RDoc documentation for net-scp-1.0.4...
Installing RDoc documentation for net-ssh-gateway-1.1.0...
Installing RDoc documentation for capistrano-2.14.1...
[root@vm02 ~]#
[root@vm02 ~]# gem list

*** LOCAL GEMS ***

capistrano (2.14.1)
daemon_controller (1.1.0)
fastthread (1.0.7)
highline (1.6.15)
i18n (0.4.2)
json (1.7.6)
mysql (2.9.0)
net-scp (1.0.4)
net-sftp (2.0.5)
net-ssh (2.6.3)
net-ssh-gateway (1.1.0)
passenger (3.0.18)
rack (1.1.2)
rake (0.9.2)
rdoc (3.12)
rmagick (2.13.1)
rubygems-update (1.6.2)
rubytree (0.8.3)
structured_warnings (0.1.3)
[root@vm02 ~]#
[root@vm02 ~]# capfiify .
[add] making directory './config'
[add] writing './config/deploy.rb'
[add] writing './Capfile'
[done] capified!
[root@vm02 ~]# ls -ltr
・
・
drwxr-xr-x  2 root root      4096  114 06:29 2013 config
-rw-r--r--  1 root root       172  114 06:29 2013 Capfile

[root@vm02 ~]# vi config/deploy.rb 
role :server, 'localhost', 'localhost'

set :user, 'hoge'
set :password, 'hogehoge'

desc "reporting disk usage with 'df -h'"
task :check_disk, :roles => :server do
  run 'df -h'
end
[root@vm02 ~]#
[root@vm02 ~]#
[root@vm02 ~]# cap check_disk
  * 2013-01-15 08:26:41 executing `check_disk'
  * executing "df -h"
    servers: ["localhost"]
    [localhost] executing command
 ** [out :: localhost] Filesystem            Size  Used Avail Use% マウント位置
 ** [out :: localhost] /dev/sda2              18G  3.3G   14G  20% /
 ** [out :: localhost] tmpfs                 495M  276K  495M   1% /dev/shm
 ** [out :: localhost] /dev/sda1             291M   32M  244M  12% /boot
    command finished in 787ms
[root@vm02 ~]#

CCNPの取得への道 - SWITCH

今年の2/24でCCNAの更新が切れてまう(´・ω・`)ションボリ
2010年に取得して以来サーバサイドで仕事してきてるからNW知識は忘れているなあ。
資格取得には賛否両論あるけども抜け漏れなくある知識を体系的に補完するために利用するのはありだよね。
ってことでやるか。

下のレイヤーから順にスイッチ→ルーターってやるのが妥当だぜ。ってことで
『642-813J SWITCH642-813』を2月中に取得せねば!
http://www.cisco.com/web/JP/event/tra_ccc/ccc/certprog/paths/professional/ccnp.html

便利ツール tomahawk

ためしてみよう(・∀・)v

pipインスコ

# wget http://pypi.python.org/packages/source/s/setuptools/setuptools-0.6c11.tar.gz#md5=7df2a529a074f613b509fb44feefe74e

pypi.python.org をDNSに問いあわせています... 140.211.10.73
pypi.python.org|140.211.10.73|:80 に接続しています... 接続しました。
HTTP による接続要求を送信しました、応答を待っています... 200 OK
長さ: 256862 (251K) [application/octet-stream]
・・・
# tar xvfz setuptools-0.6c11.tar.gz
setuptools-0.6c11/
setuptools-0.6c11/version.dat
・・・
# python setup.py install
running install
running bdist_egg
・・・
# easy_install pip
Searching for pip
Reading http://pypi.python.org/simple/pip/
Reading http://www.pip-installer.org
Reading http://pip.openplans.org
Best match: pip 1.2.1
Downloading http://pypi.python.org/packages/source/p/pip/pip-1.2.1.tar.gz#md5=db8a6d8a4564d3dc7f337ebed67b1a85
Processing pip-1.2.1.tar.gz
Running pip-1.2.1/setup.py -q bdist_egg --dist-dir /tmp/easy_install-Sgj7rW/pip-1.2.1/egg-dist-tmp-1acH8B
warning: no files found matching '*.html' under directory 'docs'
warning: no previously-included files matching '*.txt' found under directory 'docs/_build'
no previously-included directories found matching 'docs/_build/_sources'
Adding pip 1.2.1 to easy-install.pth file
Installing pip script to /usr/bin
Installing pip-2.6 script to /usr/bin

Installed /usr/lib/python2.6/site-packages/pip-1.2.1-py2.6.egg
Processing dependencies for pip
Finish

tomahawkインスコ

# pip install tomahawk
Downloading/unpacking tomahawk
  Downloading tomahawk-0.5.2.tar.gz
  Running setup.py egg_info for package tomahawk
Requirement already satisfied (use --upgrade to upgrade): pexpect>=2.4 in /usr/lib/python2.6/site-packages (from tomahawk)
Requirement already satisfied (use --upgrade to upgrade): argparse in /usr/lib/python2.6/site-packages (from tomahawk)
Installing collected packages: tomahawk
  Running setup.py install for tomahawk
    changing mode of build/scripts-2.6/tomahawk from 644 to 755
    changing mode of build/scripts-2.6/tomahawk-rsync from 644 to 755
    changing mode of /usr/bin/tomahawk-rsync to 755
    changing mode of /usr/bin/tomahawk to 755
Successfully installed tomahawk
Cleaning up...
#

tomahawk使ってみる

# tomahawk --help
usage: tomahawk [--help] [--ssh SSH] [-u SSH_USER] [-o SSH_OPTIONS] [-s]
                [--sudo-password-stdin] [--no-sudo-password]
                [--output-format OUTPUT_FORMAT] [-h HOSTS] [-f HOST_FILE] [-c]
                [-p NUM] [-l] [--login-password-stdin] [-t SECONDS]
                [--expect-timeout SECONDS] [--expect-encoding ENCODING]
                [-d DELAY] [--expect-delay EXPECT_DELAY] [-D] [--deep-debug]
                [--profile] [--version]
                command [command ...]

A simple command executor for many hosts.

positional arguments:
  command               Command executed on remote hosts.

optional arguments:
  --help                show this help message and exit
  --ssh SSH             ssh program. (default: "ssh")
  -u SSH_USER, --ssh-user SSH_USER
                        ssh user.
  -o SSH_OPTIONS, --ssh-options SSH_OPTIONS
                        ssh options.
  -s, --prompt-sudo-password
                        Prompt a password for sudo.
  --sudo-password-stdin
                        Read a password for sudo from stdin.
  --no-sudo-password    OBSOTED. Never prompt a password for sudo.
  --output-format OUTPUT_FORMAT
                        Command output format. (default: '${user}@${host} %
                        ${command}\n${output}\n')
  -h HOSTS, --hosts HOSTS
                        Host names for sending commands. (splited with ",")
  -f HOST_FILE, --hosts-files HOST_FILE
                        Hosts files which listed host names. (splited with
                        ",")
  -c, --continue-on-error
                        Command exectuion continues whatever any errors.
  -p NUM, --parallel NUM
                        Process numbers for parallel command execution.
                        (default: 1)
  -l, --prompt-login-password
                        Prompt a password for ssh authentication.
  --login-password-stdin
                        Read a password for ssh authentication from stdin.
  -t SECONDS, --timeout SECONDS
                        Specify expect timeout in seconds. (default: 10)
  --expect-timeout SECONDS
                        DUPLICATED. Use --timeout
  --expect-encoding ENCODING
                        Expect encoding for password prompt. (default: utf-8)
  -d DELAY, --delay DELAY
                        Command delay time in seconds. (default: 0)
  --expect-delay EXPECT_DELAY
                        Expect delay time in seconds. (default: 0.05)
  -D, --debug           Enable debug output.
  --deep-debug          Enable deeper debug output.
  --profile             Enable profiling.
  --version             show program’s version number and exit
#
# tomahawk -h localhost,localhost 'uptime; ls /var'  -l
Enter a password for ssh authentication:

root@localhost % uptime; ls /var
 04:08:24 up 2 days, 13:37,  3 users,  load average: 0.05, 0.01, 0.00
account  crash  db     games  lib    lock  mail  opt       run    tmp  yp
cache    cvs    empty  gdm    local  log   nis   preserve  spool  www

root@localhost % uptime; ls /var
 04:08:25 up 2 days, 13:37,  3 users,  load average: 0.05, 0.01, 0.00
account  crash  db     games  lib    lock  mail  opt       run    tmp  yp
cache    cvs    empty  gdm    local  log   nis   preserve  spool  www

#