python连oracle无法实现定时任务cron,Cron任务python脚本不起作用

I have a python script I want to fire off every night at midnight. I'm using cron scheduler right now to do so, however, I can't figure out why it's not working. For now, I've been using close times (within the next minute or so) to test the cronjob, but I will ultimately want it to work for midnight.

Here is what I put in my crontab file (to run for 2:43pm), hosted on my ubuntu machine:

43 14 * * * root /home/grantmcgovern/Developer/Projects/StudyBug/Main.py

I even put the:

#!user/bin/python

on top of all the .py files.

I also did:

chmod +x "scriptname".py

For each of the .py files and still no luck. Am I missing something blatantly obvious? I should note, this is my first time playing with cron tasks.

解决方案

From your current crontab file, you're basically running root /home/grantmcgovern/Developer/Projects/StudyBug/Main.py every time.

If you want to run it as root, use sudo crontab -e and put 43 14 * * * /usr/bin/python /home/grantmcgovern/Developer/Projects/StudyBug/Main.py instead.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值