コスギデンサン >> 情報系メモ >> Python

Python : 約60秒1回プロセスを起動する。 2017/5
Version 3.6.1 on CentOS7

from multiprocessing import Process
from time import sleep

#
def child(arg):
    print("From child ", arg)

#
if __name__ == '__main__':

    i = 1
    n = 0
    while(True):
        if (n % 60 == 0) :
            p = Process(target=child, args=(i,))
            p.start
            n = 0
            i += 1
        sleep(1)
        n += 1