Shell program: Reads a parameter in a file line by row and uses this parameter to execute 5 minutes each time

Source: Internet
Author: User
Tags sleep
#!/bin/bash while
read line
    
do
    
       #杀掉所有的python程序.
    
        Killall python2
    
        #用读取到的行的参数作为输入执行 *******test.py python program and records the result to a file in the row's parameter 110ut, which is a row parameter corresponding to a log file;
        /****** *test.py $line  > {$line}11out &
        echo $line sleep
    
        20s
    
       #得到当前系统中的 *******test.py program run number
    
        of rows wcret= ' ps aux | grep *******test.py |  Wc-l '
    
        #如果行数大于1, which means that the program does not exit within 20 seconds, then executes 5 minutes
        if [$wcret-gt 1]; then sleep
                5m
    
        fi
    
       #执行5分钟后, Kill all the Python2 programs
        killall python2 sleep
        5s do
< $

Author: csdn Blog Yygydjkthh

Back to the column page: http://www.bianceng.cnhttp://www.bianceng.cn/OS/Linux/

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.