crontab -l
* * * * * python /Users/abc/Downloads/test.py
* * * * * say hello
/Users/abc/Downloads/test.py
#!/usr/bin/python
file = open('/Users/abc/Downloads/abc.txt','w')
file.write('aaaaaa')
file.close()
say hello 每分钟都能运行,但 python 的那行命令效果,换一台 mac 也试过一样无效,这个 python 脚本是我写着测试定时任务的,原先是在 python 脚本里写的的是请求 api 运行 shell 的命令。
