# cat /path/to/access_log | cut -d ' ' -f 1 | sort | uniq -c
・cutでスペース区切った1列目のみ抽出する。
・sortで同じIPが連続するようにソート(これが無いとuniqで同一だが不連続なIPが別物として扱われてしまう)
・uniqでカウント数を付加して出力
# cat /path/to/access_log | cut -d ' ' -f 1 | sort | uniq -c
参考: Installing Node.js via package manager | Node.js# curl --silent --location https://rpm.nodesource.com/setup_8.x | sudo bash -# yum install -y nodejs
でvar sys = require("sys");sys.puts("Hello World");
なお、warningはstderrの方に出ててとりあえず無視しました。# node test.jsHello World(node:22537) [DEP0025] DeprecationWarning: sys is deprecated. Use util instead.(node:22537) [DEP0027] DeprecationWarning: util.puts is deprecated. Use console.log instead.
参考: CoffeeScript# npm install --global coffeescript
$cmd = 'wget -e robots=off --recursive -k --level=1 --follow-tags=img,a --reject=php,cgi --accept=jpg,gif,png,htm,html -H -D2chan.net -P ' . $conf[ 'data' ][ 'threads' ] . '/' . $l[ 'id' ] . ' ' . $l[ 'thread_url' ] . ' > ' . $logdir . ' 2> ' . $logdir;
PHP Fatal error: Class 'DOMDocument' not found in /home/wpadminwp/wp/wordpress/wp-content/plugins/jetpack/modules/shortcodes/class.filter-embedded-html-objects.php on line 246というエラーが出ていました。
Call to undefined function pll_get_post_language() in /home/wpadminwp/wp/wordpress/wp-content/plugins/polylang/modules/plugins/plugins-compat.php on line 618ていうエラーが出るようになってしまった。。。
でGRUB_CMDLINE_LINUXの末尾にvga=771を追加後、# vim /etc/default/grub
とすると、何度かウインドウサイズが変化するものの、# grub2-mkconfig -o /boot/grub2/grub.cfg# reboot
ログ設定は後日見直す予定。# iptables -I INPUT 1 -p tcp -m tcp --dport 80 -j CNKR# iptables -I INPUT 2 -p tcp -m tcp --dport 443 -j CNKR# iptables -N LOGGING# iptables -A LOGGING -j LOG --log-level warning --log-prefix "DROP:" -m limit# iptables -A LOGGING -j DROP# ./iptables_cnkr.sh
とする。# iptables -F
としてserviceを有効化してやる必要がある。# yum install iptables-services# systemctl enable iptables
とエラーが出て取得できませんでした。# rpm --import http://apt.sw.be/RPM-GPG-KEY.dag.txtcurl: (22) The requested URL returned error: 404 Not Foundエラー: http://apt.sw.be/RPM-GPG-KEY.dag.txt: インポート読み込みに失敗しました(2)。
として追加しました。で、# rpm -Uvh http://li.nux.ro/download/nux/dextop/el7/x86_64/nux-dextop-release-0-5.el7.nux.noarch.rpm
で無事インストール完了!# yum -y --enablerepo=epel,nux-dextop install ffmpeg
デフォルトではepelを使われないようにします。# yum install -y epel-release
# vim /etc/yum.repos.d/epel.repo
でepelのenabledを0に設定しファイル更新。inotify-toolsをyumでインストールします。
インストールを確認。# yum install --enablerepo=epel -y inotify-tools
使用法はおいおい調べたいと思います。# which inotifywait/bin/inotifywait
とするとエラーになってマウントできませんでした。(エラー内容は失念)# mount -t cifs -o guest //ip.to.samba.server/public /mnt/samba
として# yum install -y cifs-utils
としたところ、無事マウントすることができました。# mount.cifs -o guest //ip.to.samba.server/public /mnt/samba
てなエラーで再起動できませんでした。$ sudo service samba restartFailed to restart samba.service: Unit samba.service is masked.
と別々に行うことで再起動できました。$ sudo service smbd restart; sudo service nmbd restart
としました。interfaces = 192.168.11. 127.0.0.0/8 wlan0
てな感じでコマンドを実行すると、一定間隔(デフォルトは2秒だそう)毎にディレクトリ内の最新ファイルを20件表示してくれます。$ watch 'ls -lrt | tail -20'
として運用しています。$ watch 'ls -lrth /tmp/motion/*.avi | tail -5'
$ git pull[remote "origin"]url = ssh://server:/path/to/git/repos/repofetch = +refs/heads/*:refs/remotes/origin/*[branch "master"]remote = originmerge = refs/heads/master
# resize2fs -f /dev/mapper/centos-rootresize2fs 1.42.9 (28-Dec-2013)resize2fs: Bad magic number in super-block while trying to open /dev/mapper/centos-rootCouldn't find valid filesystem superblock.
としたところ、無事rootのディスク容量を拡張できました。# xfs_growfs /dev/mapper/centos-rootmeta-data=/dev/mapper/centos-root isize=256 agcount=4, agsize=260096 blks= sectsz=512 attr=2, projid32bit=1= crc=0 finobt=0data = bsize=4096 blocks=1040384, imaxpct=25= sunit=0 swidth=0 blksnaming =version 2 bsize=4096 ascii-ci=0 ftype=0log =internal bsize=4096 blocks=2560, version=2= sectsz=512 sunit=0 blks, lazy-count=1realtime =none extsz=4096 blocks=0, rtextents=0data blocks changed from 1040384 to 2360320
お使いのサーバーの PHP では WordPress に必要な MySQL 拡張を利用できないようです。と表示されて先に進めませんでした。
でoid(datid)取得後、select datid,datname from pg_stat_database;
ちなみに当環境(CentOS 7.2, PostgreSQL 9.2.15)では/var/lib/pgsql/data/base/でした。$ du -ch /path/to/db