This Python script is designed to run tasks on a list of specified recurring day of the month and time. The task parameters are stored in a human-readable and easily configurable JSON file. Additionally, it records task executions in a JSON file that can be checked for historical records.
- scheduled_task_runner.py: The main script that runs tasks based on the config.json file.
- backup_now.py: A script that can be manually run to execute the default task specified in the config.json file.
- task_utils.py: A utility module containing functions used by scheduled_task_runner.py and backup_now.py.
- config.json: The configuration file containing tasks and their parameters.
- executed_tasks.json: A file storing successful task executions.
- scheduled_task_runner.log: A log file that records task execution information and errors.
- scheduled_task_runner.bat: A Windows batch file to run scheduled_task_runner.py.
- backup_now.bat: A Windows batch file to run backup_now.py.
The config.json file contains an array of tasks, where each task is an object with the following properties:
- "day_of_month": The day of the month on which the task should be executed (1-31).
- "time": The time of the day when the task should be executed, formatted as "HH:MM".
- "src": The source directory to be backed up.
- "dest": The destination directory where the backup will be stored.
- "default": (Optional) A boolean value indicating if the task is the default task to be executed by backup_now.py.
Example of config.json:
{ "tasks": [ { "day_of_month": 1, "time": "23:56", "src": "C:/source_directory_1", "dest": "C:/destination_directory_1" }, { "day_of_month": 15, "time": "12:00", "src": "C:/source_directory_2", "dest": "C:/destination_directory_2", "default": true } ] }
- scheduled_task_runner.py: Double-click the scheduled_task_runner.bat file or run it from the command prompt.
- backup_now.py: Double-click the backup_now.bat file or run it from the command prompt.