<div class="line number1 index0 alt2" style="margin: 0px; padding: 0px; color: #7f7f7f; font-family: 돋움, dotum, Tahoma, AppleGothic, sans-serif; background-color: #ffffff;">
   <code class="python comments" style="margin: 0px; padding: 0px;"><span style="font-family: &quot;맑은 고딕&quot;, &quot;malgun gothic&quot;; font-size: 12px;">#!/usr/bin/python</span></code>
   </div>
<div class="line number2 index1 alt1" style="margin: 0px; padding: 0px; color: #7f7f7f; background-color: #ffffff;"><span style="font-family: &quot;맑은 고딕&quot;, &quot;malgun gothic&quot;; font-size: 12px;">&nbsp;</span></div>
<div class="line number3 index2 alt2" style="margin: 0px; padding: 0px; color: #7f7f7f; background-color: #ffffff;">
   <code class="python keyword" style="margin: 0px; padding: 0px;"><span style="font-family: &quot;맑은 고딕&quot;, &quot;malgun gothic&quot;; font-size: 12px;">import</span></code>
   <span style="font-family: &quot;맑은 고딕&quot;, &quot;malgun gothic&quot;; font-size: 12px;">
   &nbsp;
   </span>
   <code class="python plain" style="margin: 0px; padding: 0px;"><span style="font-family: &quot;맑은 고딕&quot;, &quot;malgun gothic&quot;; font-size: 12px;">os</span></code>
   </div>
<div class="line number4 index3 alt1" style="margin: 0px; padding: 0px; color: #7f7f7f; background-color: #ffffff;">
   <code class="python keyword" style="margin: 0px; padding: 0px;"><span style="font-family: &quot;맑은 고딕&quot;, &quot;malgun gothic&quot;; font-size: 12px;">import</span></code>
   <span style="font-family: &quot;맑은 고딕&quot;, &quot;malgun gothic&quot;; font-size: 12px;">
   &nbsp;
   </span>
   <code class="python plain" style="margin: 0px; padding: 0px;"><span style="font-family: &quot;맑은 고딕&quot;, &quot;malgun gothic&quot;; font-size: 12px;">sys</span></code>
   </div>
<div class="line number5 index4 alt2" style="margin: 0px; padding: 0px; color: #7f7f7f; background-color: #ffffff;">
   <code class="python keyword" style="margin: 0px; padding: 0px;"><span style="font-family: &quot;맑은 고딕&quot;, &quot;malgun gothic&quot;; font-size: 12px;">import</span></code>
   <span style="font-family: &quot;맑은 고딕&quot;, &quot;malgun gothic&quot;; font-size: 12px;">
   &nbsp;
   </span>
   <code class="python plain" style="margin: 0px; padding: 0px;"><span style="font-family: &quot;맑은 고딕&quot;, &quot;malgun gothic&quot;; font-size: 12px;">time</span></code>
   </div>
<div class="line number6 index5 alt1" style="margin: 0px; padding: 0px; color: #7f7f7f; background-color: #ffffff;"><span style="font-family: &quot;맑은 고딕&quot;, &quot;malgun gothic&quot;; font-size: 12px;">&nbsp;</span></div>
<div class="line number7 index6 alt2" style="margin: 0px; padding: 0px; color: #7f7f7f; background-color: #ffffff;">
   <code class="python keyword" style="margin: 0px; padding: 0px;"><span style="font-family: &quot;맑은 고딕&quot;, &quot;malgun gothic&quot;; font-size: 12px;">def</span></code>
   <span style="font-family: &quot;맑은 고딕&quot;, &quot;malgun gothic&quot;; font-size: 12px;">
   &nbsp;
   </span>
   <code class="python plain" style="margin: 0px; padding: 0px;"><span style="font-family: &quot;맑은 고딕&quot;, &quot;malgun gothic&quot;; font-size: 12px;">main():&nbsp;&nbsp;&nbsp;</span></code>
   </div>
<div class="line number8 index7 alt1" style="margin: 0px; padding: 0px; color: #7f7f7f; background-color: #ffffff;">
   <code class="python spaces" style="margin: 0px; padding: 0px;"><span style="font-family: &quot;맑은 고딕&quot;, &quot;malgun gothic&quot;; font-size: 12px;">&nbsp;&nbsp;&nbsp;&nbsp;</span></code>
   <code class="python keyword" style="margin: 0px; padding: 0px;"><span style="font-family: &quot;맑은 고딕&quot;, &quot;malgun gothic&quot;; font-size: 12px;">while</span></code>
   <code class="python plain" style="margin: 0px; padding: 0px;"><span style="font-family: &quot;맑은 고딕&quot;, &quot;malgun gothic&quot;; font-size: 12px;">(&nbsp;</span></code>
   <code class="python value" style="margin: 0px; padding: 0px;"><span style="font-family: &quot;맑은 고딕&quot;, &quot;malgun gothic&quot;; font-size: 12px;">1</span></code>
   <span style="font-family: &quot;맑은 고딕&quot;, &quot;malgun gothic&quot;; font-size: 12px;">
   &nbsp;
   </span>
   <code class="python plain" style="margin: 0px; padding: 0px;"><span style="font-family: &quot;맑은 고딕&quot;, &quot;malgun gothic&quot;; font-size: 12px;">) :</span></code>
   </div>
<div class="line number9 index8 alt2" style="margin: 0px; padding: 0px; color: #7f7f7f; background-color: #ffffff;">
   <code class="python spaces" style="margin: 0px; padding: 0px;"><span style="font-family: &quot;맑은 고딕&quot;, &quot;malgun gothic&quot;; font-size: 12px;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span></code>
   <code class="python plain" style="margin: 0px; padding: 0px;"><span style="font-family: &quot;맑은 고딕&quot;, &quot;malgun gothic&quot;; font-size: 12px;">oscommend&nbsp;</span></code>
   <code class="python keyword" style="margin: 0px; padding: 0px;"><span style="font-family: &quot;맑은 고딕&quot;, &quot;malgun gothic&quot;; font-size: 12px;">=</span></code>
   <span style="font-family: &quot;맑은 고딕&quot;, &quot;malgun gothic&quot;; font-size: 12px;">
   &nbsp;
   </span>
   <code class="python plain" style="margin: 0px; padding: 0px;"><span style="font-family: &quot;맑은 고딕&quot;, &quot;malgun gothic&quot;; font-size: 12px;">os.popen(</span></code>
   <code class="python string" style="margin: 0px; padding: 0px;"><span style="font-family: &quot;맑은 고딕&quot;, &quot;malgun gothic&quot;; font-size: 12px;">"ps aux | grep process_name.py | awk '{print $12}'"</span></code>
   <code class="python plain" style="margin: 0px; padding: 0px;"><span style="font-family: &quot;맑은 고딕&quot;, &quot;malgun gothic&quot;; font-size: 12px;">).readlines()</span></code>
   </div>
<div class="line number10 index9 alt1" style="margin: 0px; padding: 0px; color: #7f7f7f; background-color: #ffffff;">
   <code class="python spaces" style="margin: 0px; padding: 0px;"><span style="font-family: &quot;맑은 고딕&quot;, &quot;malgun gothic&quot;; font-size: 12px;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span></code>
   <code class="python plain" style="margin: 0px; padding: 0px;"><span style="font-family: &quot;맑은 고딕&quot;, &quot;malgun gothic&quot;; font-size: 12px;">check_process&nbsp;</span></code>
   <code class="python keyword" style="margin: 0px; padding: 0px;"><span style="font-family: &quot;맑은 고딕&quot;, &quot;malgun gothic&quot;; font-size: 12px;">=</span></code>
   <span style="font-family: &quot;맑은 고딕&quot;, &quot;malgun gothic&quot;; font-size: 12px;">
   &nbsp;
   </span>
   <code class="python string" style="margin: 0px; padding: 0px;"><span style="font-family: &quot;맑은 고딕&quot;, &quot;malgun gothic&quot;; font-size: 12px;">"%s"</span></code>
   <span style="font-family: &quot;맑은 고딕&quot;, &quot;malgun gothic&quot;; font-size: 12px;">
   &nbsp;
   </span>
   <code class="python keyword" style="margin: 0px; padding: 0px;"><span style="font-family: &quot;맑은 고딕&quot;, &quot;malgun gothic&quot;; font-size: 12px;">%</span></code>
   <span style="font-family: &quot;맑은 고딕&quot;, &quot;malgun gothic&quot;; font-size: 12px;">
   &nbsp;
   </span>
   <code class="python plain" style="margin: 0px; padding: 0px;"><span style="font-family: &quot;맑은 고딕&quot;, &quot;malgun gothic&quot;; font-size: 12px;">( oscommend[</span></code>
   <code class="python value" style="margin: 0px; padding: 0px;"><span style="font-family: &quot;맑은 고딕&quot;, &quot;malgun gothic&quot;; font-size: 12px;">0</span></code>
   <code class="python plain" style="margin: 0px; padding: 0px;"><span style="font-family: &quot;맑은 고딕&quot;, &quot;malgun gothic&quot;; font-size: 12px;">] )</span></code>
   </div>
<div class="line number11 index10 alt2" style="margin: 0px; padding: 0px; color: #7f7f7f; background-color: #ffffff;">
   <code class="python spaces" style="margin: 0px; padding: 0px;"><span style="font-family: &quot;맑은 고딕&quot;, &quot;malgun gothic&quot;; font-size: 12px;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span></code>
   <code class="python keyword" style="margin: 0px; padding: 0px;"><span style="font-family: &quot;맑은 고딕&quot;, &quot;malgun gothic&quot;; font-size: 12px;">if</span></code>
   <span style="font-family: &quot;맑은 고딕&quot;, &quot;malgun gothic&quot;; font-size: 12px;">
   &nbsp;
   </span>
   <code class="python plain" style="margin: 0px; padding: 0px;"><span style="font-family: &quot;맑은 고딕&quot;, &quot;malgun gothic&quot;; font-size: 12px;">( check_rsync.find(</span></code>
   <code class="python string" style="margin: 0px; padding: 0px;"><span style="font-family: &quot;맑은 고딕&quot;, &quot;malgun gothic&quot;; font-size: 12px;">"process_name.py"</span></code>
   <code class="python plain" style="margin: 0px; padding: 0px;"><span style="font-family: &quot;맑은 고딕&quot;, &quot;malgun gothic&quot;; font-size: 12px;">)&nbsp;</span></code>
   <code class="python keyword" style="margin: 0px; padding: 0px;"><span style="font-family: &quot;맑은 고딕&quot;, &quot;malgun gothic&quot;; font-size: 12px;">=</span></code>
   <code class="python keyword" style="margin: 0px; padding: 0px;"><span style="font-family: &quot;맑은 고딕&quot;, &quot;malgun gothic&quot;; font-size: 12px;">=</span></code>
   <span style="font-family: &quot;맑은 고딕&quot;, &quot;malgun gothic&quot;; font-size: 12px;">
   &nbsp;
   </span>
   <code class="python keyword" style="margin: 0px; padding: 0px;"><span style="font-family: &quot;맑은 고딕&quot;, &quot;malgun gothic&quot;; font-size: 12px;">-</span></code>
   <code class="python value" style="margin: 0px; padding: 0px;"><span style="font-family: &quot;맑은 고딕&quot;, &quot;malgun gothic&quot;; font-size: 12px;">1</span></code>
   <span style="font-family: &quot;맑은 고딕&quot;, &quot;malgun gothic&quot;; font-size: 12px;">
   &nbsp;
   </span>
   <code class="python plain" style="margin: 0px; padding: 0px;"><span style="font-family: &quot;맑은 고딕&quot;, &quot;malgun gothic&quot;; font-size: 12px;">) :</span></code>
   </div>
<div class="line number12 index11 alt1" style="margin: 0px; padding: 0px; color: #7f7f7f; background-color: #ffffff;">
   <code class="python spaces" style="margin: 0px; padding: 0px;"><span style="font-family: &quot;맑은 고딕&quot;, &quot;malgun gothic&quot;; font-size: 12px;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span></code>
   <code class="python plain" style="margin: 0px; padding: 0px;"><span style="font-family: &quot;맑은 고딕&quot;, &quot;malgun gothic&quot;; font-size: 12px;">os.system(</span></code>
   <code class="python string" style="margin: 0px; padding: 0px;"><span style="font-family: &quot;맑은 고딕&quot;, &quot;malgun gothic&quot;; font-size: 12px;">"./process_name.py &amp;"</span></code>
   <code class="python plain" style="margin: 0px; padding: 0px;"><span style="font-family: &quot;맑은 고딕&quot;, &quot;malgun gothic&quot;; font-size: 12px;">)</span></code>
   </div>
<div class="line number13 index12 alt2" style="margin: 0px; padding: 0px; color: #7f7f7f; background-color: #ffffff;">
   <code class="python spaces" style="margin: 0px; padding: 0px;"><span style="font-family: &quot;맑은 고딕&quot;, &quot;malgun gothic&quot;; font-size: 12px;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span></code>
   <span style="font-family: &quot;맑은 고딕&quot;, &quot;malgun gothic&quot;; font-size: 12px;">
   &nbsp;</span></div>
<div class="line number14 index13 alt1" style="margin: 0px; padding: 0px; color: #7f7f7f; background-color: #ffffff;">
   <code class="python spaces" style="margin: 0px; padding: 0px;"><span style="font-family: &quot;맑은 고딕&quot;, &quot;malgun gothic&quot;; font-size: 12px;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span></code>
   <code class="python keyword" style="margin: 0px; padding: 0px;"><span style="font-family: &quot;맑은 고딕&quot;, &quot;malgun gothic&quot;; font-size: 12px;">try</span></code>
   <code class="python plain" style="margin: 0px; padding: 0px;"><span style="font-family: &quot;맑은 고딕&quot;, &quot;malgun gothic&quot;; font-size: 12px;">:</span></code>
   </div>
<div class="line number15 index14 alt2" style="margin: 0px; padding: 0px; color: #7f7f7f; background-color: #ffffff;">
   <code class="python spaces" style="margin: 0px; padding: 0px;"><span style="font-family: &quot;맑은 고딕&quot;, &quot;malgun gothic&quot;; font-size: 12px;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span></code>
   <code class="python plain" style="margin: 0px; padding: 0px;"><span style="font-family: &quot;맑은 고딕&quot;, &quot;malgun gothic&quot;; font-size: 12px;">time.sleep(</span></code>
   <code class="python value" style="margin: 0px; padding: 0px;"><span style="font-family: &quot;맑은 고딕&quot;, &quot;malgun gothic&quot;; font-size: 12px;">3</span></code>
   <code class="python plain" style="margin: 0px; padding: 0px;"><span style="font-family: &quot;맑은 고딕&quot;, &quot;malgun gothic&quot;; font-size: 12px;">)</span></code>
   </div>
<div class="line number16 index15 alt1" style="margin: 0px; padding: 0px; color: #7f7f7f; background-color: #ffffff;">
   <code class="python spaces" style="margin: 0px; padding: 0px;"><span style="font-family: &quot;맑은 고딕&quot;, &quot;malgun gothic&quot;; font-size: 12px;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span></code>
   <code class="python keyword" style="margin: 0px; padding: 0px;"><span style="font-family: &quot;맑은 고딕&quot;, &quot;malgun gothic&quot;; font-size: 12px;">except</span></code>
   <span style="font-family: &quot;맑은 고딕&quot;, &quot;malgun gothic&quot;; font-size: 12px;">
   &nbsp;
   </span>
   <code class="python plain" style="margin: 0px; padding: 0px;"><span style="font-family: &quot;맑은 고딕&quot;, &quot;malgun gothic&quot;; font-size: 12px;">Exception, e:</span></code>
   </div>
<div class="line number17 index16 alt2" style="margin: 0px; padding: 0px; color: #7f7f7f; background-color: #ffffff;">
   <code class="python spaces" style="margin: 0px; padding: 0px;"><span style="font-family: &quot;맑은 고딕&quot;, &quot;malgun gothic&quot;; font-size: 12px;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span></code>
   <code class="python functions" style="margin: 0px; padding: 0px;"><span style="font-family: &quot;맑은 고딕&quot;, &quot;malgun gothic&quot;; font-size: 12px;">print</span></code>
   <span style="font-family: &quot;맑은 고딕&quot;, &quot;malgun gothic&quot;; font-size: 12px;">
   &nbsp;
   </span>
   <code class="python plain" style="margin: 0px; padding: 0px;"><span style="font-family: &quot;맑은 고딕&quot;, &quot;malgun gothic&quot;; font-size: 12px;">e</span></code>
   </div>
<div class="line number18 index17 alt1" style="margin: 0px; padding: 0px; color: #7f7f7f; background-color: #ffffff;">
   <code class="python spaces" style="margin: 0px; padding: 0px;"><span style="font-family: &quot;맑은 고딕&quot;, &quot;malgun gothic&quot;; font-size: 12px;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span></code>
   <code class="python plain" style="margin: 0px; padding: 0px;"><span style="font-family: &quot;맑은 고딕&quot;, &quot;malgun gothic&quot;; font-size: 12px;">sys.exit()</span></code>
   </div>
<div class="line number19 index18 alt2" style="margin: 0px; padding: 0px; color: #7f7f7f; background-color: #ffffff;"><span style="font-family: &quot;맑은 고딕&quot;, &quot;malgun gothic&quot;; font-size: 12px;">&nbsp;</span></div>
<div class="line number20 index19 alt1" style="margin: 0px; padding: 0px; color: #7f7f7f; background-color: #ffffff;">
   <code class="python keyword" style="margin: 0px; padding: 0px;"><span style="font-family: &quot;맑은 고딕&quot;, &quot;malgun gothic&quot;; font-size: 12px;">if</span></code>
   <span style="font-family: &quot;맑은 고딕&quot;, &quot;malgun gothic&quot;; font-size: 12px;">
   &nbsp;
   </span>
   <code class="python plain" style="margin: 0px; padding: 0px;"><span style="font-family: &quot;맑은 고딕&quot;, &quot;malgun gothic&quot;; font-size: 12px;">__name__&nbsp;</span></code>
   <code class="python keyword" style="margin: 0px; padding: 0px;"><span style="font-family: &quot;맑은 고딕&quot;, &quot;malgun gothic&quot;; font-size: 12px;">=</span></code>
   <code class="python keyword" style="margin: 0px; padding: 0px;"><span style="font-family: &quot;맑은 고딕&quot;, &quot;malgun gothic&quot;; font-size: 12px;">=</span></code>
   <span style="font-family: &quot;맑은 고딕&quot;, &quot;malgun gothic&quot;; font-size: 12px;">
   &nbsp;
   </span>
   <code class="python string" style="margin: 0px; padding: 0px;"><span style="font-family: &quot;맑은 고딕&quot;, &quot;malgun gothic&quot;; font-size: 12px;">"__main__"</span></code>
   <span style="font-family: &quot;맑은 고딕&quot;, &quot;malgun gothic&quot;; font-size: 12px;">
   &nbsp;
   </span>
   <code class="python plain" style="margin: 0px; padding: 0px;"><span style="font-family: &quot;맑은 고딕&quot;, &quot;malgun gothic&quot;; font-size: 12px;">:</span></code>
   </div>
<div class="line number21 index20 alt2" style="margin: 0px; padding: 0px; color: #7f7f7f; background-color: #ffffff;">
   <code class="python spaces" style="margin: 0px; padding: 0px;"><span style="font-family: &quot;맑은 고딕&quot;, &quot;malgun gothic&quot;; font-size: 12px;">&nbsp;&nbsp;&nbsp;&nbsp;</span></code>
   <code class="python plain" style="margin: 0px; padding: 0px;"><span style="font-family: &quot;맑은 고딕&quot;, &quot;malgun gothic&quot;; font-size: 12px;">main()</span></code>
   </div>
<br style="color: #7f7f7f; font-family: 돋움, dotum, Tahoma, AppleGothic, sans-serif; background-color: #ffffff;" /><br style="color: #7f7f7f; font-family: 돋움, dotum, Tahoma, AppleGothic, sans-serif; background-color: #ffffff;" />
<p><span style="color: #7f7f7f; font-family: 돋움, dotum, Tahoma, AppleGothic, sans-serif; background-color: #ffffff;">출처:&nbsp;</span><a href="https://codestore.tistory.com/97" style="color: #959595; text-decoration-line: none; font-family: 돋움, dotum, Tahoma, AppleGothic, sans-serif; background-color: #ffffff;" target="_blank">https://codestore.tistory.com/97</a><span style="color: #7f7f7f; font-family: 돋움, dotum, Tahoma, AppleGothic, sans-serif; background-color: #ffffff;">&nbsp;[코드 보관소]</span>&nbsp;</p>