Linux cron and init

If you plan to do something by linux it's self

you may wanna use 'cron'

but how to do it !

On ubuntu !You can come into the /etc/cron.d/

and create your script ....



and then write some plan ...




and my create_data_table.py script will be run every day 16:00

That's what i wanna ..


</step02> How to run something when the machine start ....


vim  /etc/rc.local



But if your programer is blocking ,and you wanna run more than one script ..

You may be need to write a start.py like there I write a multi_process.py


#!/usr/bin/python

import multiprocessing

import os


def run_consumer():

        os.execl('/home/txcs/AK/z2.0/consumer.py','i')

def run_producer():

        os.execl('/home/txcs/AK/z2.0/producer.py','i')

def run_broker():

        os.execl('/home/txcs/AK/z2.0/broker.py','i')

if __name__ == '__main__':


        for i in range(5):

                c = multiprocessing.Process(target = run_consumer)

                c.start()

        p_broker = multiprocessing.Process(target = run_broker)

        p_broker.start()

        p_producer = multiprocessing.Process(target = run_producer)

        p_producer.start()


</step03>  have fun ...




评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值