Jattie van der Linde

Shoe string engineering

User Tools

Site Tools


linux:python_cron

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
linux:python_cron [2024/10/26 11:53] jattielinux: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`:
-    <code python>+    <code bash>
     #!/bin/bash     #!/bin/bash
     source /path/to/anaconda/envs/your_env_name/bin/activate     source /path/to/anaconda/envs/your_env_name/bin/activate
Line 16: Line 16:
  
   - **Make the Script Executable**: Give the script execute permissions:   - **Make the Script Executable**: Give the script execute permissions:
-    <code python>+    <code bash>
     chmod +x /path/to/run_script.sh     chmod +x /path/to/run_script.sh
     </code>     </code>
  
   - **Edit the Crontab**: Open the crontab file to schedule your script:   - **Edit the Crontab**: Open the crontab file to schedule your script:
-    <code python>+    <code bash>
     crontab -e     crontab -e
     </code>     </code>
linux/python_cron.txt · Last modified: 2024/10/26 11:54 by jattie