{"id":700,"date":"2013-02-28T06:09:29","date_gmt":"2013-02-28T06:09:29","guid":{"rendered":"http:\/\/linuxmotto.ir\/blog\/?p=700"},"modified":"2013-03-03T02:24:19","modified_gmt":"2013-03-03T02:24:19","slug":"%d8%b1%d8%a7%d9%87-%d8%a7%d9%86%d8%af%d8%a7%d8%b2%db%8c-%d9%85%d8%ac%d8%af%d8%af-%d8%b3%d8%b1%d9%88%db%8c%d8%b3%d9%87%d8%a7-%d8%a8%d8%b9%d8%af-%d8%a7%d8%b2-%d8%a8%d8%b1%d9%88%d8%b2%d8%b1%d8%b3%d8%a7","status":"publish","type":"post","link":"https:\/\/linuxmotto.io\/blog\/?p=700","title":{"rendered":"\u0631\u0627\u0647 \u0627\u0646\u062f\u0627\u0632\u06cc \u0645\u062c\u062f\u062f \u0633\u0631\u0648\u06cc\u0633\u0647\u0627 \u0628\u0639\u062f \u0627\u0632 \u0628\u0631\u0648\u0632\u0631\u0633\u0627\u0646\u06cc"},"content":{"rendered":"<p>\u0645\u062f\u062a\u06cc \u0628\u0648\u062f \u062f\u0646\u0628\u0627\u0644 \u0631\u0627\u0647 \u062d\u0644\u06cc \u0645\u06cc \u06af\u0634\u062a\u0645 \u062a\u0627 \u0628\u0639\u062f \u0627\u0632 \u0628\u0647 \u0631\u0648\u0632 \u0631\u0633\u0627\u0646\u06cc \u062f\u0631 \u0635\u0648\u0631\u062a\u06cc \u06a9\u0647 \u0633\u06cc\u0633\u062a\u0645 \u0646\u06cc\u0627\u0632 \u0628\u0647 restart \u062f\u0627\u0631\u0647 \u0645\u062a\u0648\u062c\u0647 \u0628\u0634\u0645.<\/p>\n<p>\u0645\u062f\u062a\u06cc \u0628\u0648\u062f \u0628\u0627 \u0628\u0633\u062a\u0647 \u0627\u06cc \u0628\u0647 \u0646\u0627\u0645 debian-goodies \u0622\u0634\u0646\u0627 \u0634\u062f\u0647 \u0628\u0648\u062f\u0645 \u06a9\u0647 \u0645\u062c\u0645\u0648\u0639\u0647 \u0627\u06cc \u0627\u0632 \u062f\u0633\u062a\u0648\u0631\u0627\u062a \u06a9\u0627\u0631\u0628\u0631\u062f\u06cc \u0628\u0648\u062f. \u06cc\u06a9\u06cc \u0627\u0632 \u0627\u06cc\u0646 \u062f\u0633\u062a\u0648\u0631\u0627\u062a checkrestart \u0647\u0633\u062a \u06a9\u0647 \u0633\u0631\u0648\u06cc\u0633\u200c\u0647\u0627\u06cc\u06cc \u06a9\u0647 \u0628\u0627\u06cc\u062f restart \u0634\u0648\u0646\u062f \u0648 \u0628\u0633\u062a\u0647\u200c\u0647\u0627\u06cc\u06cc \u06a9\u0647 \u0633\u0631\u0648\u06cc\u0633\u06cc \u0627\u0632 \u0622\u0646\u0647\u0627 \u0627\u0633\u062a\u0641\u0627\u062f\u0647 \u0646\u0645\u06cc \u06a9\u0646\u062f \u06a9\u0647 restart \u0633\u0631\u0648\u06cc\u0633 \u0645\u0634\u06a9\u0644 \u0631\u0627 \u062d\u0644 \u06a9\u0646\u062f \u0631\u0627 \u0644\u06cc\u0633\u062a \u0645\u06cc \u06a9\u0646\u062f.<\/p>\n<p>\u0627\u06cc\u0646 \u062f\u0633\u062a\u0648\u0631 \u062a\u0646\u0647\u0627 \u06af\u0632\u0627\u0631\u0634 \u0645\u06cc\u200c\u062f\u0647\u062f \u0648 \u062e\u0648\u062f \u0627\u0642\u062f\u0627\u0645 \u0628\u0647 \u0631\u0627\u0647 \u0627\u0646\u062f\u0627\u0632\u06cc \u0645\u062c\u062f\u062f \u0633\u0631\u0648\u06cc\u0633 \u0647\u0627 \u0648 \u0633\u06cc\u0633\u062a\u0645 \u0646\u0645\u06cc \u06a9\u0646\u062f. \u0628\u0631\u0627\u06cc \u0627\u06cc\u0646 \u0645\u0646\u0638\u0648\u0631 (\u06cc\u0639\u0646\u06cc \u0631\u0627\u0647 \u0627\u0646\u062f\u0627\u0632\u06cc \u062e\u0648\u062f\u06a9\u0627\u0631 \u0633\u0631\u0648\u06cc\u0633\u200c\u0647\u0627) \u062f\u0631 \u0646\u0633\u062e\u0647 \u062c\u062f\u06cc\u062f \u0628\u0633\u062a\u0647 \u0627\u0633\u06a9\u0631\u06cc\u067e\u062a\u06cc \u0628\u0647 \u0646\u0627\u0645 <a title=\"restart-services\" href=\"https:\/\/github.com\/tpo\/debian-goodies\/blob\/master\/restart-services\">restart-services<\/a> \u0645\u0639\u0631\u0641\u06cc \u0634\u062f\u0647 \u0627\u0633\u062a \u06a9\u0647 \u0647\u0646\u0648\u0632 \u0628\u0627 \u0645\u0634\u06a9\u0644 \u0627\u062c\u0631\u0627 \u0645\u06cc \u06af\u0631\u062f\u062f \u0648 \u0639\u0645\u0644\u0627 \u06a9\u0627\u0631 \u0646\u0645\u06cc \u06a9\u0646\u062f.<\/p>\n<p>\u0645\u0646 \u0627\u0648\u0645\u062f\u0645 \u0627\u06cc\u0646 \u0627\u0633\u06a9\u0631\u06cc\u067e\u062a \u0631\u0627 \u0628\u0631\u0627\u06cc \u062e\u0648\u062f\u0645 \u0627\u0635\u0644\u0627\u062d \u06a9\u0631\u062f\u0645 <!--more-->\u062a\u0627 \u0627\u0632\u0634 \u0627\u0633\u062a\u0641\u0627\u062f\u0647 \u06a9\u0646\u0645. \u0627\u0644\u0628\u062a\u0647 \u0627\u0633\u06a9\u0631\u06cc\u067e\u062a \u062e\u06cc\u0644\u06cc \u0641\u06a9\u0631 \u0634\u062f\u0647 \u0648 \u062a\u0631\u0648 \u062a\u0645\u06cc\u0632\u06cc \u0646\u06cc\u0633\u062a \u0648\u0644\u06cc \u06a9\u0627\u0631 \u0645\u06cc \u06a9\u0646\u0647 . \u0633\u0631\u0648\u06cc\u0633 \u0647\u0627\u06cc \u0645\u0648\u0631\u062f \u0646\u06cc\u0627\u0632 \u0631\u0627 restart \u0645\u06cc \u06a9\u0646\u0647 \u0648 \u062f\u0631 \u0635\u0648\u0631\u062a \u0646\u06cc\u0627\u0632 \u0628\u0647 \u0631\u0627\u0647 \u0627\u0646\u062f\u0627\u0632\u06cc \u0645\u062c\u062f\u062f \u0633\u06cc\u0633\u062a\u0645 \u0639\u0627\u0645\u0644 \u0628\u0631\u0627\u06cc \u0645\u062f\u06cc\u0631 \u0633\u06cc\u0633\u062a\u0645 \u0627\u06cc\u0645\u06cc\u0644\u06cc \u0627\u0631\u0633\u0627\u0644 \u0645\u06cc \u06a9\u0646\u062f.<\/p>\n<blockquote>\n<p dir=\"ltr\">#!\/bin\/bash<br \/>\n#<br \/>\n# This program is free software; you can redistribute it and\/or modify<br \/>\n# it under the terms of the GNU General Public License as published by<br \/>\n# the Free Software Foundation; either version 2, or (at your option)<br \/>\n# any later version.<\/p>\n<p dir=\"ltr\"># This program is distributed in the hope that it will be useful,<br \/>\n# but WITHOUT ANY WARRANTY; without even the implied warranty of<br \/>\n# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the<br \/>\n# GNU General Public License for more details.<\/p>\n<p dir=\"ltr\"># You should have received a copy of the GNU General Public License<br \/>\n# along with this program; if not, write to the Free Software<br \/>\n# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,<br \/>\n# MA 02110-1301 USA<br \/>\n#<br \/>\n# On Debian systems, a copy of the GNU General Public License may be<br \/>\n# found in \/usr\/share\/common-licenses\/GPL.<br \/>\n#<br \/>\n# Sysadmin email address<br \/>\nSYSADM=&#8221;behrad_es@yahoo.com&#8221;<\/p>\n<p dir=\"ltr\">function help()<br \/>\n{<br \/>\ncat&lt;&lt;-EOH<br \/>\n$0 [-h|&#8211;help] [-s]<br \/>\nTry to restart services, as indicated by checkrestart.<\/p>\n<p dir=\"ltr\">Options:<br \/>\n-h, &#8211;help &#8230; help<br \/>\n-s, &#8211;simulate &#8230; simulate, do nothing, just print actions<\/p>\n<p dir=\"ltr\">Return codes:<br \/>\n0 &#8230; OK<br \/>\n1 &#8230; error<br \/>\n2 &#8230; warning<br \/>\nEOH<\/p>\n<p dir=\"ltr\">exit 0<br \/>\n}<\/p>\n<p dir=\"ltr\">function simulate ()<br \/>\n{<br \/>\necho &#8220;This\/These service(s) need restart:&#8221;<br \/>\ncheckrestart\u00a0 2&gt;\/dev\/null | sed -n &#8216;\/^These are the init scripts:\/,\/^$\/ p&#8217; | grep init.d<\/p>\n<p dir=\"ltr\">echo &#8220;&#8221;<br \/>\necho &#8220;These files need restart server to upgraded&#8221;<br \/>\ncheckrestart\u00a0 2&gt;\/dev\/null | sed -n &#8216;\/^These processes do not seem to have an associated init script to restart them:\/,\/^$\/ p&#8217; | grep &#8220;\/.*&#8221;<\/p>\n<p dir=\"ltr\">exit 0<br \/>\n}<\/p>\n<p dir=\"ltr\"># arguments parsing<br \/>\nwhile [ &#8220;$#&#8221; != &#8220;0&#8221; ]; do<br \/>\ncase &#8220;$1&#8221; in<br \/>\n-s|&#8211;simulate)<br \/>\nsimulate<br \/>\n;;<br \/>\n-h|&#8211;help)<br \/>\nhelp<br \/>\n;;<br \/>\nesac<br \/>\nshift<br \/>\ndone<\/p>\n<p dir=\"ltr\"># Restart serivices after update<br \/>\nOIFS=$IFS<br \/>\nIFS=&#8221;<br \/>\n&#8221;<br \/>\ncheckrestart\u00a0 2&gt;\/dev\/null | sed -n &#8216;\/^These are the init scripts:\/,\/^$\/ p&#8217; | grep init.d | mail -s &#8220;Services restarted&#8221; $SYSADM<br \/>\nfor i in `checkrestart\u00a0 2&gt;\/dev\/null | sed -n &#8216;\/^These are the init scripts:\/,\/^$\/ p&#8217;\u00a0 | grep init.d`<br \/>\ndo<br \/>\neval $i<br \/>\ndone<br \/>\nIFS=$OIFS<\/p>\n<p dir=\"ltr\"># Find when restart required<br \/>\nif [ &#8220;`checkrestart\u00a0 2&gt;\/dev\/null | grep &#8220;These processes do not seem to have an associated init script to restart them:&#8221;`&#8221; != &#8220;&#8221; ]<br \/>\nthen<br \/>\necho &#8220;New upgrade need restart. Plan to restart server.&#8221;<br \/>\necho &#8220;New upgrade need restart. Plan to restart server.&#8221; | mail -s &#8220;Schedule restart&#8221; $SYSADM<br \/>\nfi<\/p>\n<p dir=\"ltr\">exit 0<\/p>\n<\/blockquote>\n","protected":false},"excerpt":{"rendered":"<p>\u0645\u062f\u062a\u06cc \u0628\u0648\u062f \u062f\u0646\u0628\u0627\u0644 \u0631\u0627\u0647 \u062d\u0644\u06cc \u0645\u06cc \u06af\u0634\u062a\u0645 \u062a\u0627 \u0628\u0639\u062f \u0627\u0632 \u0628\u0647 \u0631\u0648\u0632 \u0631\u0633\u0627\u0646\u06cc \u062f\u0631 \u0635\u0648\u0631\u062a\u06cc \u06a9\u0647 \u0633\u06cc\u0633\u062a\u0645 \u0646\u06cc\u0627\u0632 \u0628\u0647 restart \u062f\u0627\u0631\u0647 \u0645\u062a\u0648\u062c\u0647 \u0628\u0634\u0645. \u0645\u062f\u062a\u06cc \u0628\u0648\u062f \u0628\u0627 \u0628\u0633\u062a\u0647 \u0627\u06cc \u0628\u0647 \u0646\u0627\u0645 debian-goodies \u0622\u0634\u0646\u0627 \u0634\u062f\u0647 \u0628\u0648\u062f\u0645 \u06a9\u0647 \u0645\u062c\u0645\u0648\u0639\u0647 \u0627\u06cc \u0627\u0632 \u062f\u0633\u062a\u0648\u0631\u0627\u062a \u06a9\u0627\u0631\u0628\u0631\u062f\u06cc \u0628\u0648\u062f. \u06cc\u06a9\u06cc \u0627\u0632 \u0627\u06cc\u0646 \u062f\u0633\u062a\u0648\u0631\u0627\u062a checkrestart \u0647\u0633\u062a \u06a9\u0647 \u0633\u0631\u0648\u06cc\u0633\u200c\u0647\u0627\u06cc\u06cc \u06a9\u0647 \u0628\u0627\u06cc\u062f restart \u0634\u0648\u0646\u062f \u0648 \u0628\u0633\u062a\u0647\u200c\u0647\u0627\u06cc\u06cc \u06a9\u0647 \u0633\u0631\u0648\u06cc\u0633\u06cc \u0627\u0632 \u0622\u0646\u0647\u0627 \u0627\u0633\u062a\u0641\u0627\u062f\u0647 \u0646\u0645\u06cc \u06a9\u0646\u062f \u06a9\u0647 restart \u0633\u0631\u0648\u06cc\u0633 \u0645\u0634\u06a9\u0644 \u0631\u0627 \u062d\u0644 \u06a9\u0646\u062f \u0631\u0627 \u0644\u06cc\u0633\u062a \u0645\u06cc \u06a9\u0646\u062f. \u0627\u06cc\u0646 \u062f\u0633\u062a\u0648\u0631 \u062a\u0646\u0647\u0627 \u06af\u0632\u0627\u0631\u0634 \u0645\u06cc\u200c\u062f\u0647\u062f \u0648 \u062e\u0648\u062f \u0627\u0642\u062f\u0627\u0645 \u0628\u0647 \u0631\u0627\u0647 \u0627\u0646\u062f\u0627\u0632\u06cc \u0645\u062c\u062f\u062f \u0633\u0631\u0648\u06cc\u0633 \u0647\u0627 \u0648 \u0633\u06cc\u0633\u062a\u0645 \u0646\u0645\u06cc \u06a9\u0646\u062f. \u0628\u0631\u0627\u06cc \u0627\u06cc\u0646 \u0645\u0646\u0638\u0648\u0631 (\u06cc\u0639\u0646\u06cc \u0631\u0627\u0647 \u0627\u0646\u062f\u0627\u0632\u06cc \u062e\u0648\u062f\u06a9\u0627\u0631 \u0633\u0631\u0648\u06cc\u0633\u200c\u0647\u0627) \u062f\u0631 \u0646\u0633\u062e\u0647 \u062c\u062f\u06cc\u062f \u0628\u0633\u062a\u0647 \u0627\u0633\u06a9\u0631\u06cc\u067e\u062a\u06cc \u0628\u0647 \u0646\u0627\u0645 restart-services \u0645\u0639\u0631\u0641\u06cc \u0634\u062f\u0647 \u0627\u0633\u062a [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[10,17,12],"tags":[31,65,64,63],"class_list":["post-700","post","type-post","status-publish","format-standard","hentry","category-administration","category-scripting","category-debian","tag-debian-2","tag-restart-services","tag-script","tag-upgrade"],"_links":{"self":[{"href":"https:\/\/linuxmotto.io\/blog\/index.php?rest_route=\/wp\/v2\/posts\/700","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/linuxmotto.io\/blog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/linuxmotto.io\/blog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/linuxmotto.io\/blog\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/linuxmotto.io\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=700"}],"version-history":[{"count":5,"href":"https:\/\/linuxmotto.io\/blog\/index.php?rest_route=\/wp\/v2\/posts\/700\/revisions"}],"predecessor-version":[{"id":703,"href":"https:\/\/linuxmotto.io\/blog\/index.php?rest_route=\/wp\/v2\/posts\/700\/revisions\/703"}],"wp:attachment":[{"href":"https:\/\/linuxmotto.io\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=700"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/linuxmotto.io\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=700"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/linuxmotto.io\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=700"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}