简体   繁体   中英

Python Script Doesn't Work After Put It On Crontab

I Have a python file named myfile.py that I want to run it every 1 minute.

When I use this command : 'python myfile.py' It Runs Correctly.

But when I set time for it and put it in crontab it doesn't work.

What the hell is my problem?

my crontab -e configurations:

1 * * * * python /home/myuser/Desktop/myfile.py 

You're missing a slash before home .

Try

1 * * * * python /home/myuser/Desktop/myfile.py 

您是否尝试过明确指定解释器路径?

1 * * * * /usr/bin/python /home/myuser/Desktop/myfile.py 

All these codes are correct. Consider this, perhaps your code is in the comment terminal.

You must remove the "#" mark from the beginning of the code.

this is Comment

    #1 * * * * python /home/myuser/Desktop/myfile.py 

this is Correct

    1 * * * * python /home/myuser/Desktop/myfile.py 

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM