Skip to content

Scheduled Run

terrelsa13 edited this page Jan 3, 2025 · 21 revisions

Linux

  1. If the configuraiton file has not been created; go to Linux First Run and follow the steps.

  2. Open a terminal window using the following keyboard shortcut: ctrl+alt+t

  3. In the terminal window type the following command:

    crontab -e
    
  4. In the crontab file, type one of the following commands:

    Example #1

    To run /opt/MUMC/mumc.py everyday at 03:21hrs (aka 3:21am)

    21 3 * * * python3 /opt/MUMC/mumc.py
    

    Example #2

    To run /opt/MUMC/mumc.py every Monday at 01:23hrs (aka 1:23am) and save the output to log file /var/log/mumc.log

    23 1 * * 1 python3 /opt/mumc/mumc.py > /var/log/mumc.log 2>&1
    

The following links are a good starting point to learn the crontab syntax:

Learn MUMC terminology

Windows

  • If the configuraiton file has not been created; go to Windows First Run and follow the steps.
  • There are many pages online, like this one, showing how to use the Windows Task Scheduler to run a Python script.

Learn MUMC terminology

Docker

Seperate Container With Crontab

  • TBD

Crontab Inside Of MUMC Container

  • TBD

Crontab On Host Machine

Yes I know, hardcore Docker users won't like using the host machine's crontab.
  1. If the configuraiton file has not been created; go to Docker First Run and follow the steps.

  2. Open a terminal window on the host machine using the following keyboard shortcut: ctrl+alt+t

  3. In the terminal window type the following commands:

    crontab -e
  4. In the crontab file, copy/paste one of the examples; or make your own custom command:

    Example #1

    To run the mumc container everyday at 03:21hrs (aka 3:21am)

    21 3 * * * docker run --rm --name mumc ghcr.io/terrelsa13/mumc:latest python /usr/src/app/mumc.py

    Example #2

    To run /opt/MUMC/mumc.py every Monday at 01:23hrs (aka 1:23am) and save the output to log file /var/log/mumc.log

    23 1 * * 1 docker run --rm --name mumc ghcr.io/terrelsa13/mumc:latest python /usr/src/app/mumc.py > /usr/src/app/config/mumc_CRON_OUTPUT.log 2>&1

Learn MUMC terminology

Clone this wiki locally