{"id":6162,"date":"2016-04-10T20:33:41","date_gmt":"2016-04-10T11:33:41","guid":{"rendered":"https:\/\/www.taruki.com\/wp\/?p=6162"},"modified":"2016-05-03T22:19:43","modified_gmt":"2016-05-03T13:19:43","slug":"%e3%81%a9%e3%81%a9%e3%82%93%e3%81%a8%e3%81%b5%e3%82%92debiannginx%e3%81%a7%e5%8b%95%e3%81%8b%e3%81%99%e3%82%84%e3%82%8a%e6%96%b9%e9%81%8b%e7%94%a8%e3%83%84%e3%83%bc%e3%83%ab%e7%b7%a8%ef%bc%a0","status":"publish","type":"post","link":"https:\/\/www.taruki.com\/wp\/?p=6162","title":{"rendered":"\u3069\u3069\u3093\u3068\u3075\u3092debian+nginx\u3067\u52d5\u304b\u3059\u3084\u308a\u65b9(\u904b\u7528\u30c4\u30fc\u30eb\u7de8)\uff20\u516c\u5f0f\u9bd63rd\u30b7\u30ea\u30fc\u30ba"},"content":{"rendered":"<p>\u7b2c1\u56de:\u00a0<a href=\"https:\/\/www.taruki.com\/wp\/?p=6099\">OS\u7de8<\/a><\/p>\n<p>\u7b2c2\u56de:\u00a0<a href=\"https:\/\/www.taruki.com\/wp\/?p=6123\">nginx\u30bb\u30c3\u30c8\u30a2\u30c3\u30d7\u7de8<\/a><\/p>\n<p>\u7b2c3\u56de: <a href=\"https:\/\/www.taruki.com\/wp\/?p=6133\">fcgi\u7de8<\/a><\/p>\n<p>\u7b2c4\u56de: <a href=\"https:\/\/www.taruki.com\/wp\/?p=6160\">\u3069\u3069\u3093\u3068\u3075\u672c\u4f53\u7de8<\/a><\/p>\n<p>\u4eca\u56de: \u904b\u7528\u30c4\u30fc\u30eb\u7de8(\u6700\u4f4e\u9650)<\/p>\n<p>\u524d\u56de\u307e\u3067\u3001\u4f5c\u308a\u8fbc\u3093\u3060\u72b6\u614b\u3067\u306f\u3001saveData\u304cRAMDISK\u306b\u4fdd\u5b58\u3057\u3066\u3044\u308b\u305f\u3081\u3001\u30b5\u30fc\u30d0\u30fc\u3092\u30b7\u30e3\u30c3\u30c8\u30c0\u30a6\u30f3\u3059\u308b\u3068\u30c7\u30fc\u30bf\u304c\u6d88\u3048\u3066\u3057\u307e\u3044\u307e\u3059\u306e\u3067\u3001\u5b9a\u671f\u7684\u306b\u5225SSD\u306a\u308aHDD\u306b\u30b3\u30d4\u30fc\u3057\u3066\u30c7\u30fc\u30bf\u3092\u4fdd\u8b77\u3059\u308b\u5fc5\u8981\u304c\u3042\u308a\u307e\u3059\u3002\u540c\u6642\u30a2\u30af\u30bb\u30b9\u6570\u304c100\uff5e200\u4eba\u7a0b\u5ea6\u3067\u3042\u308c\u3070\u9ad8\u901f\u306aSSD\u306b\u76f4\u63a5\u4fdd\u5b58\u3057\u3066\u3082\u554f\u984c\u3042\u308a\u307e\u305b\u3093\u3002<\/p>\n<p>\u4ee5\u4e0b\u306e\u3088\u3046\u306a\u30b9\u30af\u30ea\u30d7\u30c8\u3092\u4f5c\u6210\u3057cron\u3067\u5b9a\u671f\u7684\u306b\u5b9f\u884c\u3055\u305b\u307e\u3059\u3002(\u516c\u5f0f\u9bd6\u306f5\u5206\u304a\u304d\u306b\u5b9f\u884c)<br \/>\n(\u5b9f\u969b\u306e\u516c\u5f0f\u9bd6\u306f\u3001\u5f85\u6a5f\u7cfb\u30b5\u30fc\u30d0\u30fc\u3068\u30c7\u30fc\u30bf\u540c\u671f\u3059\u308brsync\u51e6\u7406\u3082\u542b\u3093\u3067\u3044\u307e\u3059\u304c\u3001\u305d\u306e\u90e8\u5206\u306f\u9664\u5916\u3057\u3066\u8a18\u8f09\u3057\u3066\u3044\u307e\u3059\u3002)<br \/>\n<PRE><br \/>\n#!\/bin\/bash<br \/>\necho &#8220;&#8212; start &#8212;&#8221;<br \/>\ndate<\/p>\n<p>echo &#8220;&#8212; Check lockfile &#8212;&#8221;<br \/>\nLOCKFILE=\/root\/script\/sync_webdir.lock<br \/>\nif [ -f ${LOCKFILE} ]<br \/>\nthen<br \/>\n  echo &#8220;${LOCKFILE} is exsist&#8221;<br \/>\n  exit<br \/>\nfi<\/p>\n<p>echo &#8220;&#8212; Commit ramdisk to ssd &#8212;&#8221;<br \/>\nif [ ! -d \/srv\/ram\/data ]<br \/>\nthen<br \/>\n  echo &#8220;Ramdisk image not found&#8221;<br \/>\n  exit<br \/>\nfi<\/p>\n<p>echo &#8220;&#8212; Create lockfile &#8212;&#8221;<br \/>\n> ${LOCKFILE}<\/p>\n<p>btrfs subvolume snapshot \/srv\/ram \/srv\/ram\/snapshot.lock<br \/>\ncd \/srv\/ram\/snapshot.lock &#038;&#038; rsync -aAXv &#8211;delete &#8211;exclude=&#8217;*.lock&#8217; data \/srv\/ssd\/<br \/>\nbtrfs subvolume delete \/srv\/ram\/snapshot.lock<\/p>\n<p>btrfs subvolume snapshot \/srv\/ssd\/www \/srv\/ssd\/www.snapshot<\/p>\n<p>echo &#8220;&#8212; end &#8212;&#8221;<br \/>\ndate<\/p>\n<p>rm -f ${LOCKFILE}<br \/>\n<\/PRE><br \/>\n\u6b21\u306e\u76e3\u8996\u30b7\u30a7\u30eb\u306f\u3001\u5225\u306b\u5fc5\u9808\u3067\u306f\u3042\u308a\u307e\u305b\u3093\u304c\u3001\u591a\u304f\u306e\u30ea\u30af\u30a8\u30b9\u30c8\u3092\u51e6\u7406\u3059\u308b\u969b\u306b\u3001\u3069\u3069\u3093\u3068\u3075\u672c\u4f53\u306e\u554f\u984c\u3060\u3063\u305f\u308a\u3001OS\u304c\u30e1\u30e2\u30ea\u4e0d\u8db3\u306b\u306a\u3063\u305f\u308a\u3067\u4e0d\u610f\u306b\u30d7\u30ed\u30bb\u30b9\u304c\u30c0\u30a6\u30f3\u3057\u3066\u3057\u307e\u3046\u3053\u3068\u304c\u3042\u308a\u307e\u3059\u306e\u3067\u3001<br \/>\n\u3053\u308c\u30923\u5206\u304a\u304d\u306b\u52d5\u304b\u3057\u3066\u3044\u307e\u3059\u3002(\u95be\u5024\u3092\u30cf\u30fc\u30c9\u30b3\u30fc\u30c7\u30a3\u30f3\u30b0\u3057\u3066\u3044\u308b\u3068\u3053\u3068\u304c\u30c0\u30b5\u3044\u3067\u3059\u304c\u3001\u4e00\u3064\u306e\u516c\u5f0f\u9bd6\u6bce\u306b40\u30d7\u30ed\u30bb\u30b9\u3092\u7a3c\u50cd\u3055\u305b\u3066\u3044\u307e\u3059\u304c\u3001\u3053\u308c\u304c15\u3092\u5207\u308b\u3068\u518d\u8d77\u52d5\u3055\u305b\u308b\u3088\u3046\u306b\u3057\u3066\u3044\u307e\u3059)<br \/>\n<PRE><br \/>\n#!\/bin\/bash<br \/>\nfunction checkService<br \/>\n{<br \/>\n  systemctl is-active $1 >\/dev\/null 2>&#038;1<br \/>\n  if [ $? != 0 ]<br \/>\n  then<br \/>\n    echo &#8220;Service ${1} is down. Restarting&#8230;&#8221;<br \/>\n    systemctl restart $1<br \/>\n  else<br \/>\n    echo &#8220;Service ${1} is alived.&#8221;<br \/>\n  fi<br \/>\n  PS_NUM=`ps -ef |grep $2 |wc -l`<br \/>\n  if [ ${PS_NUM} -lt 15 ]<br \/>\n  then<br \/>\n    echo &#8220;${1} is down.(Leser than 15) Restarting&#8230;&#8221;<br \/>\n    systemctl restart $1<br \/>\n  else<br \/>\n    echo &#8220;Service ${1} is alived.(${PS_NUM} processes are running.)&#8221;<br \/>\n  fi<br \/>\n}<\/p>\n<p>date<br \/>\ncheckService dodontof_srv1 DodontoF_srv1<br \/>\ndate<br \/>\n<\/PRE><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u7b2c1\u56de:\u00a0OS\u7de8 \u7b2c2\u56de:\u00a0nginx\u30bb\u30c3\u30c8\u30a2\u30c3\u30d7\u7de8 \u7b2c3\u56de: fcgi\u7de8 \u7b2c4\u56de: \u3069\u3069\u3093\u3068\u3075\u672c\u4f53\u7de8 \u4eca\u56de: \u904b\u7528\u30c4\u30fc\u30eb\u7de8(\u6700\u4f4e\u9650) \u524d\u56de\u307e\u3067\u3001\u4f5c\u308a\u8fbc\u3093\u3060\u72b6\u614b\u3067\u306f\u3001saveData\u304cRAMDISK\u306b\u4fdd\u5b58\u3057\u3066\u3044\u308b\u305f\u3081\u3001\u30b5 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_crdt_document":"","footnotes":""},"categories":[48],"tags":[50,51,49,52],"class_list":["post-6162","post","type-post","status-publish","format-standard","hentry","category-48","tag-debian","tag-dodontof","tag-linux","tag-nginx"],"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/www.taruki.com\/wp\/index.php?rest_route=\/wp\/v2\/posts\/6162","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.taruki.com\/wp\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.taruki.com\/wp\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.taruki.com\/wp\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.taruki.com\/wp\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=6162"}],"version-history":[{"count":0,"href":"https:\/\/www.taruki.com\/wp\/index.php?rest_route=\/wp\/v2\/posts\/6162\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.taruki.com\/wp\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=6162"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.taruki.com\/wp\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=6162"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.taruki.com\/wp\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=6162"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}