The shell program reads the number of references in a file on a per-line basis and uses this parameter to run for 5 minutes each time

Source: Internet
Author: User

/*********************************************************************
* Author:samson
* date:04/18/2014
* Test Platform:
* Linux Ubuntu 3.2.0-58-generic-pae
* GNU Bash, version 4.2.39
* *******************************************************************/

#!/bin/bash

While read line

Do

#杀掉全部的python程序.

Killall Python2

#用读取到的行的參数作为输入运行 *******test.py python program, and the results are recorded in the line of the 110ut file, which is a row of the corresponding log file;

./*******test.py $line > {$line}11out &
Echo $line

Sleep 20s

#得到当前系统中的 the number of rows executed by the *******test.py program

wcret= ' ps aux |  grep *******test.py | Wc-l '

#假设行数大于1, the program does not exit within 20 seconds and then runs for 5 minutes

if [$wcret-gt 1]; then
Sleep 5m

Fi

#运行5分钟后, kill all the Python2 programs.

Killall Python2
Sleep 5s
Done < $

The shell program reads the number of references in a file on a per-line basis and uses this parameter to run for 5 minutes each time

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.