[英]How: Python Script to execute Terminal Command every hour?
我正在尝试使用python脚本重复执行curl命令,是否有更好的方法来执行此类任务?
Below findings can help you in linux environment. 以下发现可以在Linux环境中为您提供帮助。
You can do that with the help of a cron jab. 您可以在cron戳刺的帮助下完成此操作。
Steps to setup a cron job: 设置cron作业的步骤:
Open crontab by the command "crontab -e" on the shell 在外壳上通过命令“ crontab -e”打开crontab
Paste the following in the file and correct the path 0 * * * * /home/sshashank/script.py 将以下内容粘贴到文件中,并更正路径0 * * * * /home/sshashank/script.py
Make sure you have given proper permissions to the folders where python script is going to run, folder where it is going to access(files/logs). 确保您对要运行python脚本的文件夹,要访问的文件夹(文件/日志)具有适当的权限。
Please provide absolute path and not relative path. 请提供绝对路径而不是相对路径。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.