{"id":502,"date":"2004-08-27T01:44:02","date_gmt":"2004-08-26T23:44:02","guid":{"rendered":"http:\/\/vasil.ludost.net\/blog\/?p=502"},"modified":"2004-08-27T01:44:02","modified_gmt":"2004-08-26T23:44:02","slug":"2004-08-27-0144","status":"publish","type":"post","link":"https:\/\/vasil.ludost.net\/blog\/?p=502","title":{"rendered":"2004-08-27 01:44"},"content":{"rendered":"<p>\u0422\u0438\u0445, \u0441\u043f\u043e\u043a\u043e\u0435\u043d \u0434\u0435\u043d&#8230; \u041e\u043f\u0440\u0430\u0432\u0438\u0445 \u0435\u0434\u043d\u0430-\u0434\u0432\u0435 \u0434\u0440\u0435\u0431\u043e\u043b\u0438\u0438, \u0438 \u0437\u0430 \u043f\u043e\u0440\u0435\u0434\u0435\u043d \u043f\u044a\u0442 \u0441\u0435 \u0443\u0431\u0435\u0434\u0438\u0445, \u0447\u0435 \u0432\u0441\u0438\u0447\u043a\u0438 \u0441\u043a\u0440\u0438\u043f\u0442\u043e\u0432\u0435, \u043a\u043e\u0438\u0442\u043e \u0441\u0435 \u043f\u0443\u0441\u043a\u0430\u0442 \u043e\u0442 crontab, \u0442\u0440\u044f\u0431\u0432\u0430 \u0434\u0430 \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0432\u0430\u0442 \u0437\u0430 \u0440\u0430\u0431\u043e\u0442\u0435\u0449\u043e \u0442\u044f\u0445\u043d\u043e \u043a\u043e\u043f\u0438\u0435&#8230; \u0415\u0442\u043e \u0435\u0434\u0438\u043d template \u0437\u0430 \u0442\u0430\u043a\u0438\u0432\u0430 \u0441\u043a\u0440\u0438\u043f\u0442\u043e\u0432\u0435:<\/p>\n<pre>\r\n#!\/bin\/sh\r\n#the script's uniqe name\r\nname=SCRIPTNAME\r\n\r\nif [ -f \/var\/run\/$name.pid ]; then\r\n        if [ -d \/proc\/`cat \/var\/run\/$name.pid` ] ; then\r\n                echo $name.sh already running!\r\n                exit 0\r\n        fi\r\nfi\r\n\r\necho $$ > \/var\/run\/$name.pid\r\ntrap \"rm -f \/var\/run\/$name.pid\" exit SIGHUP SIGINT SIGTERM \r\n\r\n#do some stuff\r\necho Ugabugabuga\r\n#cleanup\r\nrm -f \/var\/run\/$name.pid\r\n<\/pre>\n<p>\u0412 \u043c\u043e\u043c\u0435\u043d\u0442\u0430 \u0440\u0430\u0431\u043e\u0442\u0438 \u0441\u0430\u043c\u043e \u0437\u0430 linux, \u043f\u043e\u043d\u0435\u0436\u0435 \u0438\u0437\u043f\u043e\u043b\u0437\u0432\u0430\u043c \/proc, \u0437\u0430 \u0434\u0430 \u043f\u0440\u043e\u0432\u0435\u0440\u044f \u0434\u0430\u043b\u0438 pid-\u0430 \u043d\u0430 \u043f\u0440\u043e\u0446\u0435\u0441\u0430 \u0435 \u0432\u0430\u043b\u0438\u0434\u0435\u043d, \u0449\u0435 \u0440\u0430\u0431\u043e\u0442\u0438 \u043d\u0430 \u0432\u0441\u0438\u0447\u043a\u0438 unix-\u0438, \u043a\u043e\u0438\u0442\u043e \u0438\u043c\u0430\u0442 \u0442\u0430\u043a\u0430\u0432\u0430 \u0441\u0435\u043c\u0430\u043d\u0442\u0438\u043a\u0430.<\/p>\n<p>\u0412\u0435\u0447\u0435\u0440\u0442\u0430 \u0441 \u0412\u0435\u043b\u0438\u043d \u0433\u043b\u0435\u0434\u0430\u0445\u043c\u0435 &#8220;\u0422\u0435\u043e\u0440\u0438\u044f \u043d\u0430 \u043a\u043e\u043d\u0441\u043f\u0438\u0440\u0430\u0446\u0438\u044f\u0442\u0430&#8221;, \u0441\u043b\u0435\u0434 \u043a\u043e\u0435\u0442\u043e \u0430\u0437 \u0438\u0437\u043b\u044f\u0437\u043e\u0445 \u0434\u0430 \u0441\u0435 \u0440\u0430\u0437\u0445\u043e\u0434\u044f \u043c\u0430\u043b\u043a\u043e, \u0447\u0435 \u043f\u043e-\u0433\u043e\u043b\u044f\u043c\u0430\u0442\u0430 \u0447\u0430\u0441\u0442 \u043e\u0442 \u0434\u0435\u043d\u044f \u0441\u0438 \u0431\u044f\u0445 \u0441\u0442\u043e\u044f\u043b \u0432\u043a\u044a\u0449\u0438. \u0420\u0430\u0437\u0445\u043e\u0434\u043a\u0430\u0442\u0430 \u043f\u043e \u0446\u0435\u043d\u0442\u044a\u0440\u0430 \u043d\u0430 \u0421\u043e\u0444\u0438\u044f \u0432 1:00 \u0435 \u043f\u0440\u0438\u044f\u0442\u043d\u0430, \u043d\u044f\u043c\u0430 \u043c\u043d\u043e\u0433\u043e \u0445\u043e\u0440\u0430, \u043d\u043e \u0430\u0437 \u0441\u0435 \u0438\u0437\u043f\u043e\u0442\u0438\u0445 \u0431\u0430\u044f, \u043e\u0449\u0435 \u0441\u0438 \u0431\u0435\u0448\u0435 \u0433\u043e\u0440\u0435\u0449\u043e&#8230; \u041a\u043e\u0433\u0430 \u043b\u0438 \u0449\u0435 \u0434\u043e\u0439\u0434\u0435 \u0435\u0441\u0435\u043d\u0442\u0430&#8230;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u0422\u0438\u0445, \u0441\u043f\u043e\u043a\u043e\u0435\u043d \u0434\u0435\u043d&#8230; \u041e\u043f\u0440\u0430\u0432\u0438\u0445 \u0435\u0434\u043d\u0430-\u0434\u0432\u0435 \u0434\u0440\u0435\u0431\u043e\u043b\u0438\u0438, \u0438 \u0437\u0430 \u043f\u043e\u0440\u0435\u0434\u0435\u043d \u043f\u044a\u0442 \u0441\u0435 \u0443\u0431\u0435\u0434\u0438\u0445, \u0447\u0435 \u0432\u0441\u0438\u0447\u043a\u0438 \u0441\u043a\u0440\u0438\u043f\u0442\u043e\u0432\u0435, \u043a\u043e\u0438\u0442\u043e \u0441\u0435 \u043f\u0443\u0441\u043a\u0430\u0442 \u043e\u0442 crontab, \u0442\u0440\u044f\u0431\u0432\u0430 \u0434\u0430 \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0432\u0430\u0442 \u0437\u0430 \u0440\u0430\u0431\u043e\u0442\u0435\u0449\u043e \u0442\u044f\u0445\u043d\u043e \u043a\u043e\u043f\u0438\u0435&#8230; \u0415\u0442\u043e \u0435\u0434\u0438\u043d template \u0437\u0430 \u0442\u0430\u043a\u0438\u0432\u0430 \u0441\u043a\u0440\u0438\u043f\u0442\u043e\u0432\u0435: #!\/bin\/sh #the script&#8217;s uniqe name name=SCRIPTNAME if [ -f \/var\/run\/$name.pid ]; then if [ -d \/proc\/`cat \/var\/run\/$name.pid` ] ; then echo $name.sh [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-502","post","type-post","status-publish","format-standard","hentry","category-general"],"_links":{"self":[{"href":"https:\/\/vasil.ludost.net\/blog\/index.php?rest_route=\/wp\/v2\/posts\/502","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/vasil.ludost.net\/blog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/vasil.ludost.net\/blog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/vasil.ludost.net\/blog\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/vasil.ludost.net\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=502"}],"version-history":[{"count":0,"href":"https:\/\/vasil.ludost.net\/blog\/index.php?rest_route=\/wp\/v2\/posts\/502\/revisions"}],"wp:attachment":[{"href":"https:\/\/vasil.ludost.net\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=502"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/vasil.ludost.net\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=502"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/vasil.ludost.net\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=502"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}