I have a python script that I'd like to add to cron.
The script has +x permission on it.
How shall I add it to crontab? (say, I want it to run every minute).
Important: when I navigate (using the shell) to the script's folder, I cannot run it using "./script_name.py"; it doesn't work. Yet, when I run it using "Python script_name.py", everything works.
From cron
you should be running the script as script_name.py
and your script meets the following criteria:
#!/usr/bin/env python
PATH
/usr/local/bin/
or /opt/local/bin/
(and they are accessible to your system PATH
.)If these conditions are met, you should be able to run it from anywhere on your local system as script_name.py
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With