[英]How to run python code a the time I want, from terminal mac Os
I'm ratheк new to programming, and my question is rather simple: How to run a bunch of code at time that I want? 我是编程的新手,我的问题很简单:如何在需要的时间运行一堆代码? what I mean is simply how to write a programm or a command in Terminal on macOs (I'm using 10.7) that will run python code at 3 o'clock AM. 我的意思是简单地如何在macO上的终端(我正在使用10.7)上编写程序或命令,该程序或命令将在凌晨3点运行python代码。 If python programm lies into: 如果python programm位于:
/Users/name/Documents/prog.py
To run the programm simply from Terminal I use: 要仅从终端运行程序,请使用:
cd /Users/name/Documents/
python prog.py
'hit Enter'
You need cron: http://en.wikipedia.org/wiki/Cron 您需要cron: http : //en.wikipedia.org/wiki/Cron
Cron is the time-based job scheduler in Unix-like computer operating systems. Cron是类Unix计算机操作系统中基于时间的作业调度程序。 Cron enables users to schedule jobs (commands or shell scripts) to run periodically at certain times or dates. Cron使用户可以计划作业(命令或Shell脚本),使其在特定时间或日期定期运行。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.