linux:python_cron
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revision | |||
linux:python_cron [2024/10/26 11:53] – jattie | linux:python_cron [2024/10/26 11:54] (current) – [How to Run a Python Script in a Cron Scheduler in a Specific Anaconda Virtual Environment] jattie | ||
---|---|---|---|
Line 7: | Line 7: | ||
- **Create a Shell Script**: Write a shell script to activate the virtual environment and run your Python script. Save this script, for example, as `run_script.sh`: | - **Create a Shell Script**: Write a shell script to activate the virtual environment and run your Python script. Save this script, for example, as `run_script.sh`: | ||
- | < | + | < |
#!/bin/bash | #!/bin/bash | ||
source / | source / | ||
Line 16: | Line 16: | ||
- **Make the Script Executable**: | - **Make the Script Executable**: | ||
- | < | + | < |
chmod +x / | chmod +x / | ||
</ | </ | ||
- **Edit the Crontab**: Open the crontab file to schedule your script: | - **Edit the Crontab**: Open the crontab file to schedule your script: | ||
- | < | + | < |
crontab -e | crontab -e | ||
</ | </ |
linux/python_cron.1729943609.txt.gz · Last modified: 2024/10/26 11:53 by jattie