systemctl stop iptables.service
systemctl stop ip6tables.service
systemctl stop ebtables.service
systemctl mask iptables.service
systemctl mask ip6tables.service
systemctl mask ebtables.service
・maskしてサービスを無効にする
sudo systemctl mask httpd.service
=>ln -s '/dev/null' '/etc/systemd/system/httpd.service'
Unitファイルは/etc/systemd/system⇒/usr/lib/systemd/systemの順に参照される。優先度の高い/etc/systemd/system上に/dev/nullへのシンボリックリンクを配置することで、対象Unitへの操作を無効化している事が分かる。
・変更を有効にする
systemctl daemon-reload
・変更ログ
journalctl
該当サービスの直近のシステムログが表示されています。
rsyslogに送られるメッセージは、systemd-journaldというデーモンが監視しており、
すべてsystemd独自のログ(ジャーナル)にも保存されています。
ここで表示されるログは、ジャーナルから取り出しているため、実際のログの出力ファイルに関わらずすべてのログがここで確認できます。
上記のコマンドに-fオプションをつけると、「tail...
2014/12/19
svn 衝突
編集 (e) - マージされたファイルにエディタで変更を加えます
全差分 (df) - マージによってファイルに加えられた変更をすべて表示します
解決版 (r) - マージされたバージョンのファイルを採用します
衝突表示 (dc) - (マージされたバージョンを無視して) 衝突をすべて表示します
衝突自分 (mc) - (同上) すべての衝突に関して自分のバージョンを採用します
衝突他人 (tc) - (同上) すべての衝突に関して他人のバージョンを採用します
完全自分 (mf) - (衝突がなくても) ファイル全体で自分のバージョンを採用します
完全他人 (tf) - (同上) ファイル全体で他人のバージョンを採用します
延期 (p) - 競合に、後で解決する予定であるという印をつけます
起動 (l) - 競合を解決するために外部ツールを起動します
...
linux apache2.4 module memo
■proxyモジュール多いね
LoadModule proxy_module modules/mod_proxy.so
LoadModule lbmethod_bybusyness_module modules/mod_lbmethod_bybusyness.so
LoadModule lbmethod_byrequests_module modules/mod_lbmethod_byrequests.so
LoadModule lbmethod_bytraffic_module modules/mod_lbmethod_bytraffic.so
LoadModule lbmethod_heartbeat_module modules/mod_lbmethod_heartbeat.so
LoadModule proxy_ajp_module modules/mod_proxy_ajp.so
LoadModule proxy_balancer_module modules/mod_proxy_balancer.so
LoadModule proxy_connect_module modules/mod_proxy_connect.so
LoadModule proxy_express_module...
linux command tips
ssh sed 正規表現
sed -i "s/\r//"
sed "s/aaa/bbb/i"
==->i 大文字と小文字区別しない
grep -i
-i Aとaは区別しない
★disown nonhup
disown---->番号が分かれば、disown 番号
nonhup---->事前でやる
★vi 小文字、大文字変換---------------------
g~~===>小文字、大文字変換
★★linux exec----
シェルから
% ls
とコマンドを実行すると、シェルは以下のことを行う。
システムコール fork(2) を呼び、子プロセスを生成する。
子プロセスは ls を exec(2) する。
親プロセスであるシェルは、ls の実行が完了するのを待つ (wait する)。
一方、
% exec ls
と exec を使うと、シェルは fork(2) せず、いきなり ls コマンドを exec(2) する (シェルの内部コマンド exec(1) を実行すると、内部でシステムコール...
scala study memo
・Predef is a great place to start to understand the Scala Library
==>Predefに定義された関数は、すべてのScalaのソースにおいて自動でimportされている
printやprintlnはPredefで定義されている。JavaのようにSystem.out.printlnという長い記述をしなくても、printlnのみで標準出力ができるのは、これのお陰。
・Array===>scala.collection.mutable.ArrayLike
scala myfirstScript.scala my first script
==>args...引数のこと args.foreach(println);
追加:
var oldList=List(1,2)
val newList=3 :: oldList
==>newList 3:2:1
var theList= newList : +3
the :: method. The job of the ::...
INI-style
構造の単純なテキストファイルであり、設定ファイルの標準です。
このファイルは主にWindowsで使用するが、他のプラットフォームでも使われる。
INIファイルという名前はこのファイルの一般的な拡張子「.INI」から来ている。INIとはinitializationである。
その他に「.CFG」や「.conf」、あるいは「.TXT」も使われる。
パラメータ name=value
セクション [section]
コメント ; comment text
★ansible lineinfile
This module will search a file for a line, and ensure that it is present or absent.
This is primarily useful when you want to change a single line in a file only.
For other cases, see the copy or template modules.
オプション
・backrefs->insertbefore and insertafter will be ignored,...
jmeter NonGUIDriver Could not find the TestPlan class
結論から言うと親要素が無い不完全なJMXファイルを作成していたから
翻訳のせいかな。。
save=->保存
save Test Plan As =>テスト計画に名前を使って保存する
Save Selection As =>別名で保存
==>選択された部分だけ保存する、これは罠であ...
php windows Class 'mysqlli' not found in
php.ini==->c:/windows 下の物
phpinfoで見える:
Loaded Configuration File C:\windows\php...
windows service httpd
httpd.exe -k restart/start/stop/install/uninstall -n "serviceNa...
php study memo
Each active resource has a unique identifier. Each identifier is a numerical index into
an internal PHP lookup table that holds information about all the active resources. PHP
maintains information about each resource in this table, including the number of references
to (or uses of) the resource throughout the code. When the last reference to a
resource value goes away, the extension that created the resource is called to free any
memory, close any connection
=->
$res=database_connect();
...
$res="boo"
automatic cleanup
// is_resource()
==>Many...
a library vs a framework
・your code call libraries ,frameoworks call your code
・framework==>Don't call us, we'll call you
framework
===>
Frameworks are not the cure for all programming
problems. Putting aside today's awesome state of
development, you should always remember how
frameworks were created a few years ago. Most of them
were more or less unoptimized junk created by one guy to
help him speed up his development process, without much
care for documentation, elegance, ease of use, or even
readability of his code. Then another group of guys took
this code...
ftp 421 service not available vsftpd
yum install vsftpd
--->サーバー
yum install ftp
--->テスト用のクライアント
★vsftpd tcp_wrappers=YES
==>権限/etc/hostsに渡る
★vsftpd tcp_wrappers=YES
500 failed to open file
=>SeLinux有効になっってる。
getenforce
sudo setenforce...
2014/11/14
systemd mysql.service file where
Q:
mysqlをrpmをインストールして、systemctlの設定はどこ?
==>何?mysql?
sudo systemd show mysql
here is the same man
Implementation of systemd is imminent, yet after days of research I can
not find a mysqld.service file that actually works in Debian. I've
searched and searched, asked on mailing lists, and asked in IRC on
#debian, #systemd, and #mysql.
Nobody knows, or at least nobody helps. There isn't even a
mysqld.service file in Sid's mysql-server package.
=ーー>ぜんぜんみつかりません。。。
じゃ。。rpmファイルを解析する
=ー>そんなsrc.rpmはない。。
yum localinstall
==>
ローカルにあるのrpmファイルをyumでインストールする方法。
依存性のファイルをレポジトリから探してきてくれるのが超便利です。
=-->ないです。
How...
2014/11/13
linux eth1 ifconfig network-scripts
Q:今のVMですが、自動的にIPをアサインする物があり、
ifconfigで=> eth1 eth2
/network-scriptsのところは、eth0だけ。。。中にIPがない
再起動してIPはかわらない。VMであるが、このIPの情報はどこで保存された?
ネットワーク
1準仮想化ネットワーク(NAT)
2準仮想化ネットワーク(ホストオンリーアダブター virtualBox Host-only Ethernet Apapter)
A:
ifup eht0
==>デバイスはない
ifup eht1
==>デバイスに対する設定はみつかりません
==>設定ファイルの名前たしかに対応している
eth1を作ればいい。。
ーーーーーーーーー
DEVICE=eth1
TYPE=Ethernet
IPADDR=
NETMASK=
NETWORK=127.0.0.0
BROADCAST=
OTPROTO=static
ONBOOT=yes
HWADDR=。。。
ーーーーーーー...
2014/11/07
msg: the python mysqldb module is required
まずは pip を入れる。
# yum -y install python-setuptools
# easy_install pip
必要な依存パッケージをインストールする。
# yum -y install python-devel mysql-devel
# pip install mysql-python
# pip freeze | grep -i mysql
MySQL-python==1.2.3
...
2014/10/28
bash if option
if test -x ....
then
fi
====>いろいろな条件
[ -a FILE ] True if FILE exists.
[ -b FILE ] True if FILE exists and is a block-special file.
[ -c FILE ] True if FILE exists and is a character-special file.
[ -d FILE ] True if FILE exists and is a directory.
[ -e FILE ] True if FILE exists.
[ -f FILE ] True if FILE exists and is a regular file.
[ -g FILE ] True if FILE exists and its SGID bit is set.
[ -h FILE ] ...
Eclipseでショートカットが効かない
Ctrl+zやCtrl+sが効かなくなった、
ウィンドウ→設定→一般→キー
[デフォルトの復元]で元に戻った。
下手に設定いじくってたみたい...
linux gnome 電源管理問題、vboxディスク拡張
----
インストールに問題があります!
GNOME電源管理のデフォルトの設定が正しくインストールされていないようです。
システム管理者に問い合わせてみて下さい。
---
原因はおそらくHDD残量の不足かと思います。
df -h
==>Use 100%
・virtualbox ハードディスク拡張
VBoxManager.exe modifyhd "*.vid" --resize **
で。。。GParted Live (Default settings)でやる
・linux disk構成管理
ここもいろいろわからない
disk-->物理ボリュームー>論理ボリュームグループー>論理ボリューム
(下記はファイルシステムの領域に入る)
ー>マウントポイントー>フォルダ/file
df,fdisk===>などなど、普段は使っているが、上記のどの段階で何のためのコマンド、よくわからず。。。
df ==>ファイル・システムについて,使用領域と空き領域のサイズを表示する
mount ==>論理ボリュームをファイルシステムにいれる。/etc/fstab 自動的に入れる物
fdisk コマンドで領域の確保を行い、 mke2fs コマンドで領域のフォーマットを行っておく必要があります(ファイルシステム)
fdiskコマンドでは、ハードディスクのパーティションの作成、削除、また、パーティション情報を調べる事ができます。...
2014/10/26
eclipse jdk os 32bit/64bit
I am confusing with that
I think if the os is 32bit ,then jdk,eclipse also 32bit
64bit the same
but .....
there is a lot aborting ...
i am wrong? they are wrong?
eclipse-java-luna-SR1-win32-x86_64
window7 64bit
jdk-8u20-windows-x64
i think it will be ok
but ....
oh ,this time it goes oK! I uninstall all the jdk,and reinstall th...
2014/10/24
ruby `require': no such file to load -- mysql (LoadError)
require 'mysql'
でエラーになった
でも
sudo gem install ruby-mysqlをインストール済みが。。
先に
require 'rubygems'
が必要だ。。
で、sudo ruby
=>sudo: ruby: コマンドが見つかりません
which ruby
==>/usr/local/bin
で、visodu
visudoでsecure_pathに「/usr/local/bin」を追加...
linux 色 front 環境設定
★vi
:syntax on
:syntax off
★lsの色
echo $LS_COLORS
sudo vi /etc/DIR_COLOR
eval ``
★front PS1
==>Linuxの標準シェルであるbashでは、PS1という環境変数によってプロンプトを定義している。従って、exportコマンドでPS1を変更すればいい。
==>front?
ログインして、「test@somehostname」のことね。
export PS1="$"
ログインして、「$」に変わる
~/.bashrcを修正して
PS1="\[\033[0;34m\]$PS1"
の0;32の部分はfrontの色...
linux sed
・sed 's/^192.168.0.1/&localhost/ example
==>^頭、192.168.0.1ーー>192.168.0.1&localhost
・sed '/test/'d example
==>testを含める行を削除する
g-->これはないと、行単位の初めての物がターゲットになる
・sed '2d' example =->d 削除、2第二行
sed '$d' example 最後の一行を削除する
sed '2,$d' example 第2行から最後の一行を削除する
・sed -n '/test/mytest/p' example
==>-n p 条件を満たす行をプリンターする
・sed 's#10#100#g' example
=->s後ろの物が分隔用になる
・sed -n '/test/,/let/p' example
testとletの間で確定された行をプリンタする
・sed -e '1,5d' -e's/let/letus/g' example
実行...
2014/10/03
pipをインストール
curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
python get-pip.py --proxy="http://proxy.jp:80...
InnoDB: Cannot allocate memory for the buffer pool
===>メモリーを増やしてください。*_*
freeで確...
apache Invalid command 'Order'Add Star
LoadModule authz_host_module modules/mod_authz_host.so
=>load module mod_access_compat, or update configuration to 2.4 authorization directiv...
ruby require エラー
Rubyファイルを実行するとrequireでエラーがでてるよってとき
require "kakiku"
==>エラーになり、書き方を修正する
require File.expand_path('kakiku.rb',__FILE__)=>NG
require File.expand_path('./kakiku.rb',__FILE__)=>NG
require File.expand_path('../kakiku.rb',__FILE__)=>OK
バージョン:
ruby 2.0.0p353 (2013-11-22) [x86_64-lin...
perl モジュール install
mysql_install_db --defaults-file=/etc/my.cnf --user=mysql
==>Data-Dumperのperlのモジュールが必要で。。
perlモジュールをインストールするにはCPANを使用すると便利である
http://search.cpan.org/でほしい物を検索する
例:
http://search.cpan.org/~smueller/Data-Dumper-2.154/Dumper.pm
wget http://search.cpan.org/~smueller/Data-Dumper-2.154/Dumper.pm
tar xzvf Data-Dumper-2.154.tar.gz
cd Data-Dumper-2.154
perl Makefile.PL
インストールして途中でエラーになった。
Can't locate ExtUtils/MakeMaker.pm in @INC
==>yum install perl-ExtUtils-MakeMaker
make
make test
==>エラーになった!!
make install
★他のエラー
Can't...
2014/09/19
mysql function DETERMINISTIC
・エラー:
This function has none of DETERMINISTIC, NO SQL, or READS SQL DATA in its declaration and binary logging is enabled (you *might* want to use the less safe log_bin_trust_function_creators variable)
・ファンクション生成に対する(SUPER権限を持たなければならず、決定論的か、データを修正しないかの別を宣言しなければならない)前の規制を緩和するには、グローバル log_bin_trust_function_creatorsシステム変数を1に設定します。
デフォルトで、これは0に設定されていますが、ユーザはこのようにして変更することができます。
mysql> SET GLOBAL log_bin_trust_function_creators = 1;
DETERMINISTIC特性とNOT DETERMINISTIC特性は、
あるインプットに対して、いつも同じ結果を生成するか否かを示します。
いずれかの特性を附与しない場合、デフォルト設定はNOT DETERMINISTICとなります。
ファンクションが決定論的であると宣言するには、DETERMINISTIC...
2014/08/18
mysqldumpでwhen using LOCK TABLESというエラーが出る
MySQLはダンプする前にテーブルにLockをかけるらしいのだが、そのLockをかけることができないようだ。
そこで、ダンプ時に誰も使っていない事が確認できたので(INSERTすることがない)、「--skip-lock-tables」というオプションを使ってダンプを行ったところ無事に完了した。
==>だれがつかったね。。
==> single-transaction
このオプションだとテーブルをロックせず、トランザクションの範囲でバックアップしてくれるとのことだ...
ruby on rails
bundle install
==>Install the modules include in the gemfile.
Unless you specify a version number to the gem command, Bundler will automatically install the latest version of the gem.
bundle update===>update!!
・deployの準備
bundle install --without production
group :production do
gem 'pg'
gem 'rails_12factor'
end
・@なになに。。
Once the @users variable is defined, the controller calls the view (Step 6), shown in Listing 2.6. Variables that start with the @ sign, called instance variables, are automatically...
Hibernate : Disabling contextual LOB creation as createClob() method threw error
As you noticed, this exception isn't a real problem. It happens during the boot, when Hibernate tries to retrieve some meta information from the database. If this annoys you, you can disable it:
hibernate.temp.use_jdbc_metadata_defaults fa...
mysql crash
★MySQL のクラッシュの多くは、インデックスファイルやデータファイルの破壊が原因です
-flush を指定して mysqld を開始することによって、各 SQL コマンド実行後、強制的にすべてをディスクと同期させることができます。
つまり、以下のことがなければ、通常は破壊されたテーブルを得ることはありません。
誰かまたは何かが、更新中に mysqld またはマシンを強制終了した。
更新中に mysqld が死ぬようなバグを見つけた。
テーブルを適切にロックしないで、mysqld 外でデータまたはインデックスフファイルを操作している。
優れたファイルシステムロック(通常、lockd デーモンによって処理される)をサポートしていないシステム上で、同じデータに対して、多くの mysqld サーバを実行しているか、--skip-external-locking で複数サーバを実行している。
mysqld を混乱させるような不正なデータを含んだ、破損したインデックスまたはデータファイルがある。
...
mysqldump view only
mysql -u username INFORMATION_SCHEMA
--skip-column-names --batch
-e "select table_name from tables where table_type = 'VIEW'
and table_schema = 'database'"
| xargs mysqldump -u username database
> views.sql
===>テーブルを分けるbackupする際、これがあればべんり。
--skip-column-names:
結果にカラム名を記述しません===>列名がないこと?
--batch
ブとして、カラムセパレータを使用することで、各行が新しいライン上に配置されるように、結果をプリントし...
2014/08/09
window commandline sleep hibernate
Sleep Computer
Rundll32.exe powrprof.dll,SetSuspendState Sleep
If it hibernates instead of Sleep: Hibernate must be OFF
■休止状態機能の有効・無効を切り替える方法
コマンドプロンプトを管理者として実行し、次のコマンドを入力する。
有効にする場合
> powercfg /hibernate on
無効にする場合
> powercfg /hibernate off
現在の設定を確認する場合
> powercfg /a
...
2014/07/17
git 理解深める
git config --global alias.co checkout ==>カスタマイズ
git config --global core.editor "C:\Program Files (x86)\Mozilla Firefox\firefox.exe"
.gitignore
==>
/.bundel
/db/*.sqlite3
/db/*.sqlite3-
/log/*.log
git log
remote/master
--->git clone ../...を実行する
local:master
リモートサーバーは更新された!
git fetch origin ==>リモートの更新を取得する
git remote add theName address ==>remote サーバー追加、ローカルでtheNameの名前で
git fetch name==>
Git 開発者の多くはこの考え方にもとづいた作業の流れを採用しています。つまり、完全に安定したコードのみを master ブランチに置き、いつでもリリースできる状態にしているのです。それ以外に並行して develop や next といった名前のブランチを持ち、安定性をテストするためにそこを使用します。常に安定している必要はありませんが、安定した状態になったらそれを...
ansible 特殊 オプション
対象ホスト:
hosts:
[test-sever]
test-test-[1:2][1:6]
テストオプション
★--list-hosts 対象ホスト名をリストするだけ、ほかに何もしない
ansible test-server -m ** -a "...." -i hosts --list-hosts
=>
test-test-11..test-test-16
test-test-21..test-test-26
★-l されにホストのfilterである!
ansible test-server -m ** -a "...." -i hosts -l test-test-11 ==>test-test-11だけ対象になる
ansible test-server -m ** -a "...." -i hosts -l test-test-1* ==>test-test-11~16 対象になる
★-f...
2014/07/15
Ruby On Rails
・ruby をインストールする
==>環境変数に追加する
・DevKit
ーー>downloadして解凍し、インストールする
ruby dk.rb init
==>rubyのディレクトリをconfi.ymlにincludeする
ruby dk.rb install
gem update --system
gem update rake
gem install rails
エラー==>x86_64-w64-mingw32-gcc command not found
==>devkitのバージョンが間違った!!
rails new blog
==>project作成
bundle install
==ー>projectを配置する
rake db:create
=->dbを作成する、sqlite is default
rails server
==>serverを起動する
=->地雷:no source of timezone data
----------
Try changing the tzinfo-data line in your Gemfile to gem 'tzinfo-data',...
linux awk
ファイルを行ベースで読み込んで、ディフォルトにスペースを使ってその
行をsplitする
awk '{pattern + action}' {filename}
-F フィルド分割用
cat /etc/passwd | awk -F ':' '{print $1}'
=>etc/passwdのアカウントだけ
cat /etc/passwd | awk -F ':' '{print $1"\t"$7}'
・header,tailerを出力
cat /etc/passwd | awk -F ':' 'Begin {print "name,shell"} {print $1"\t"$7} {print "blue,/bin/nosh"}'
・awk -F: '/root/' /etc/passwd
==>rootを含める行を出...
mysql sqlファイル実行
ls /a/b
cat * | myql -u user -ppass --socket=/data/mysql.sock test...
linux vi 置換 行
%1,10s/a/b/g
==>1行目から10行目まで
%11s/a/b/g
==>11行...
2014/07/14
bash pass array as paramater
baba=booba
variable=baba
echo ${variable} # baba
echo ${!variable} # booba
==>!の使い方==>更にこれを変数として扱う
bashの引数はそもそもARRAYに入れている!こいつです==>$@
---------
show_array(){
for port in $@
do
echo $port
done
}
show_array 1 2 3
==>OK
show_array(){
arrayParam=$@
for port in $array
do
echo $port
done
}
show_array 1 2 3
==>OK
arr=(1 2 3)
show_array(){
for port in $@
do
echo $port
done
}
show_array ${arr[@]}
=>OK
${arr[@]}==>[@]がないと、C言語と同じ、始めの一つのパラメータだけ対象になる
#===>長さの意味で...
2014/07/03
angularJS scope.$apply
JavaScript is Turn Based私たちが記述するJavaScriptのコードは一度に全て実行されるのではなく、ターンベースで実行される。各ターンは始めから終わりまで中断せずに走り、ターンが走っている間はブラウザ上では何も起きない。他のどのJavaScriptのコードも走っていない時は、Webページインタフェースは完全に固まる。だから不十分なJavaScriptコードはウェブページの動きを止めてしまう。変更した時に通知でき、ページを更新できる。==>EmberJS や KnockoutJS どのJavaScriptコードのターンが終わった時でも、値が変化したことを確認する。=>AngularJSこの戦略を動かすためには、データが変更された可能性がある時点を知る必要がある。そしてこれが $scope.$apply が動き始める場所だ。 $scope.$apply(function () { $scope.msgs.push(JSON.parse(msg.data)); });==>このapplyの中の物は、後で実行される感じだね...
JavaScript EventSource
・どこの仕様?Server-Sent Eventsでvar source = new EventSource("/chatFeed/");# receive messages$scope.chatFeed.addEventListener("message", $scope.addMsg, false);/** handle incoming messages: add to messages array */ $scope.addMsg = function (msg) { $scope.$apply(function () { $scope.msgs.push(JSON.parse(msg.data)); }); };・サーバー側は、必ず text/event-stream という MIME type で返さなければならない。 /** Controller action serving activity based on room */ def chatFeed(room: String) = Action...
2014/06/27
java Fork/Join
★The fork/join framework is an implementation of the ExecutorService interface that helps you take advantage of multiple processors. It is designed for work that can be broken into smaller pieces recursively. The goal is to use all the available processing power to enhance the performance of your application.
As with any ExecutorService implementation, the fork/join framework distributes tasks to worker threads in a thread pool. The fork/join framework is distinct because it uses a work-stealing algorithm. Worker threads that run out of things...
Why reduce the size of the Java JVM thread stack
★あれ、threadStack is out of heap...
When Java creates a new thread, it pre-allocates a fixed-size block of memory for that thread's stack. By reducing the size of that memory block, you can avoid running out of memory, especially if you have lots of threads - the memory saving is the reduction in stack size times the number of threads.
The downside of doing this is that you increase the chance of a Stack Overflow error.
Note that the thread stacks are created outside of the JVM heap, so even if there's plenty of memory available in the heap, you...
redis 試し
・can write to db automatically
・can store thing with four structures not only plain string key
=->redis can used to slove a wider range of problems
STINGS、LIST、SET、HASH、ZSET(順番あるET)
・publish/Subscribe 機能?raid,master/slave機能
・in-memory databases! write to hardDisk
Depending on how careful you want to be with your
data, append-only writing can be configured to never sync, sync once per second, or
sync at the completion of every operation.
・for most
databases, inserting rows is a very fast operation (inserts write to the end of an on-disk
file,...